Skip to content

Commit dd360fa

Browse files
committed
Remove json serialization dependency. Please use external visitor instead
1 parent 0ace1b4 commit dd360fa

7 files changed

+3
-35
lines changed

composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"issues": "https://github.com/php-type-language/phpdoc/issues"
1010
},
1111
"require": {
12-
"php": "^8.1",
13-
"ext-json": "*"
12+
"php": "^8.1"
1413
},
1514
"autoload": {
1615
"psr-4": {

src/DocBlock.php

-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ final class DocBlock implements
2121
OptionalDescriptionProviderInterface,
2222
TagsProviderInterface,
2323
\IteratorAggregate,
24-
\JsonSerializable,
2524
\ArrayAccess,
2625
\Countable
2726
{
@@ -95,14 +94,6 @@ public function getIterator(): \Traversable
9594
return new \ArrayIterator($this->tags);
9695
}
9796

98-
public function jsonSerialize(): array
99-
{
100-
return [
101-
'description' => $this->description,
102-
'tags' => $this->tags,
103-
];
104-
}
105-
10697
/**
10798
* @return int<0, max>
10899
*/

src/Tag/Description/Description.php

-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public static function fromStringableOrNull(string|\Stringable|null $description
3737
return self::fromStringable($description);
3838
}
3939

40-
public function jsonSerialize(): string
41-
{
42-
return $this->value;
43-
}
44-
4540
public function __toString(): string
4641
{
4742
return $this->value;

src/Tag/Description/DescriptionInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Any class that implements this interface is a description object
99
* that can be represented as a raw string scalar value.
1010
*/
11-
interface DescriptionInterface extends \JsonSerializable, \Stringable
11+
interface DescriptionInterface extends \Stringable
1212
{
1313
/**
1414
* Returns a plain string representation of this description.

src/Tag/Description/TaggedDescription.php

-5
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ public function offsetUnset(mixed $offset): void
8888
throw new \BadMethodCallException(static::class . ' objects are immutable');
8989
}
9090

91-
public function jsonSerialize(): array
92-
{
93-
return $this->components;
94-
}
95-
9691
public function __toString(): string
9792
{
9893
return \implode('', $this->components);

src/Tag/Tag.php

-9
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ public function getDescription(): ?DescriptionInterface
3131
return $this->description;
3232
}
3333

34-
public function jsonSerialize(): array
35-
{
36-
return \array_filter([
37-
'kind' => static::class,
38-
'name' => $this->name,
39-
'description' => $this->description,
40-
], static fn(mixed $value): bool => $value !== null);
41-
}
42-
4334
public function __toString(): string
4435
{
4536
if ($this->description === null) {

src/Tag/TagInterface.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
use TypeLang\PHPDoc\Tag\Description\OptionalDescriptionProviderInterface;
88

9-
interface TagInterface extends
10-
OptionalDescriptionProviderInterface,
11-
\JsonSerializable,
12-
\Stringable
9+
interface TagInterface extends OptionalDescriptionProviderInterface, \Stringable
1310
{
1411
/**
1512
* Returns the non-empty tag name string without the '@' prefix.

0 commit comments

Comments
 (0)