diff --git a/packages/better-php-doc-parser/src/PhpDocNode/AbstractTagValueNode.php b/packages/better-php-doc-parser/src/PhpDocNode/AbstractTagValueNode.php index 66e4c3adf97..fb1a0c448ab 100644 --- a/packages/better-php-doc-parser/src/PhpDocNode/AbstractTagValueNode.php +++ b/packages/better-php-doc-parser/src/PhpDocNode/AbstractTagValueNode.php @@ -82,7 +82,12 @@ abstract class AbstractTagValueNode implements AttributeAwareNodeInterface, PhpD */ public function __toString(): string { - $items = $this->completeItemsQuotes($this->items); + return $this->printItems($this->items); + } + + protected function printItems(array $items): string + { + $items = $this->completeItemsQuotes($items); $items = $this->filterOutMissingItems($items); $items = $this->makeKeysExplicit($items); diff --git a/packages/better-php-doc-parser/src/PhpDocNode/Symfony/SymfonyRouteTagValueNode.php b/packages/better-php-doc-parser/src/PhpDocNode/Symfony/SymfonyRouteTagValueNode.php index e10fcbe311d..32573238b5f 100644 --- a/packages/better-php-doc-parser/src/PhpDocNode/Symfony/SymfonyRouteTagValueNode.php +++ b/packages/better-php-doc-parser/src/PhpDocNode/Symfony/SymfonyRouteTagValueNode.php @@ -21,14 +21,12 @@ final class SymfonyRouteTagValueNode extends AbstractTagValueNode implements Sho public function __toString(): string { - if (isset($this->items['path']) || isset($this->items['localizedPaths'])) { - $this->items['path'] = $this->items['path'] ?? $this->items['localizedPaths']; + $items = $this->items; + if (isset($items['path']) || isset($items['localizedPaths'])) { + $items['path'] = $items['path'] ?? $this->items['localizedPaths']; } - $items = $this->completeItemsQuotes($this->items); - $items = $this->makeKeysExplicit($items); - - return $this->printContentItems($items); + return $this->printItems($items); } public function changeMethods(array $methods): void diff --git a/packages/better-php-doc-parser/src/PhpDocNode/Symfony/Validator/Constraints/AssertRangeTagValueNode.php b/packages/better-php-doc-parser/src/PhpDocNode/Symfony/Validator/Constraints/AssertRangeTagValueNode.php index 55473fdaa0b..529c6aaa3e6 100644 --- a/packages/better-php-doc-parser/src/PhpDocNode/Symfony/Validator/Constraints/AssertRangeTagValueNode.php +++ b/packages/better-php-doc-parser/src/PhpDocNode/Symfony/Validator/Constraints/AssertRangeTagValueNode.php @@ -21,11 +21,6 @@ final class AssertRangeTagValueNode extends AbstractTagValueNode implements Type public function toAttributeString(): string { - $items = $this->filterOutMissingItems($this->items); - $items = $this->completeItemsQuotes($items); - - $content = $this->printPhpAttributeItemsAsArray($items); - - return $this->printPhpAttributeContent($content); + return $this->printItemsToAttributeAsArrayString($this->items); } }