rector/packages/BetterPhpDocParser/ValueObject/PhpDoc/SpacingAwareTemplateTagValueNode.php
Tomas Votruba 3313a231b7 Updated Rector to commit bb609b28e327ca1fb7827b6bc548013d19a2cf4e
bb609b28e3 [Core] Always reset stopTraversal to false on next Rector visit (#4182)
2023-06-11 14:17:34 +00:00

29 lines
914 B
PHP

<?php
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\ValueObject\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use Stringable;
final class SpacingAwareTemplateTagValueNode extends TemplateTagValueNode
{
/**
* @var string
*/
private $preposition;
public function __construct(string $name, ?TypeNode $typeNode, string $description, string $preposition)
{
$this->preposition = $preposition;
parent::__construct($name, $typeNode, $description);
}
public function __toString() : string
{
// @see https://github.com/rectorphp/rector/issues/3438
# 'as'/'of'
$bound = $this->bound instanceof TypeNode ? ' ' . $this->preposition . ' ' . $this->bound : '';
$content = $this->name . $bound . ' ' . $this->description;
return \trim($content);
}
}