node printing functions consolidation

This commit is contained in:
TomasVotruba 2020-05-06 17:17:48 +02:00
parent e299302591
commit 41e952e043
3 changed files with 11 additions and 13 deletions

View File

@ -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);

View File

@ -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

View File

@ -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);
}
}