Skip to content

Commit

Permalink
Remove json serialization dependency. Please use external visitor ins…
Browse files Browse the repository at this point in the history
…tead
  • Loading branch information
SerafimArts committed Apr 6, 2024
1 parent 0ace1b4 commit dd360fa
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 35 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"issues": "https://github.com/php-type-language/phpdoc/issues"
},
"require": {
"php": "^8.1",
"ext-json": "*"
"php": "^8.1"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 0 additions & 9 deletions src/DocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ final class DocBlock implements
OptionalDescriptionProviderInterface,
TagsProviderInterface,
\IteratorAggregate,
\JsonSerializable,
\ArrayAccess,
\Countable
{
Expand Down Expand Up @@ -95,14 +94,6 @@ public function getIterator(): \Traversable
return new \ArrayIterator($this->tags);
}

public function jsonSerialize(): array
{
return [
'description' => $this->description,
'tags' => $this->tags,
];
}

/**
* @return int<0, max>
*/
Expand Down
5 changes: 0 additions & 5 deletions src/Tag/Description/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public static function fromStringableOrNull(string|\Stringable|null $description
return self::fromStringable($description);
}

public function jsonSerialize(): string
{
return $this->value;
}

public function __toString(): string
{
return $this->value;
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/Description/DescriptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Any class that implements this interface is a description object
* that can be represented as a raw string scalar value.
*/
interface DescriptionInterface extends \JsonSerializable, \Stringable
interface DescriptionInterface extends \Stringable
{
/**
* Returns a plain string representation of this description.
Expand Down
5 changes: 0 additions & 5 deletions src/Tag/Description/TaggedDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ public function offsetUnset(mixed $offset): void
throw new \BadMethodCallException(static::class . ' objects are immutable');
}

public function jsonSerialize(): array
{
return $this->components;
}

public function __toString(): string
{
return \implode('', $this->components);
Expand Down
9 changes: 0 additions & 9 deletions src/Tag/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ public function getDescription(): ?DescriptionInterface
return $this->description;
}

public function jsonSerialize(): array
{
return \array_filter([
'kind' => static::class,
'name' => $this->name,
'description' => $this->description,
], static fn(mixed $value): bool => $value !== null);
}

public function __toString(): string
{
if ($this->description === null) {
Expand Down
5 changes: 1 addition & 4 deletions src/Tag/TagInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

use TypeLang\PHPDoc\Tag\Description\OptionalDescriptionProviderInterface;

interface TagInterface extends
OptionalDescriptionProviderInterface,
\JsonSerializable,
\Stringable
interface TagInterface extends OptionalDescriptionProviderInterface, \Stringable
{
/**
* Returns the non-empty tag name string without the '@' prefix.
Expand Down

0 comments on commit dd360fa

Please sign in to comment.