1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\PhpDocParser\Ast\PhpDoc;
4:
5: use PHPStan\PhpDocParser\Ast\NodeAttributes;
6: use PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineTagValueNode;
7: use function trim;
8:
9: class PhpDocTagNode implements PhpDocChildNode
10: {
11:
12: use NodeAttributes;
13:
14: /** @var string */
15: public $name;
16:
17: /** @var PhpDocTagValueNode */
18: public $value;
19:
20: public function __construct(string $name, PhpDocTagValueNode $value)
21: {
22: $this->name = $name;
23: $this->value = $value;
24: }
25:
26:
27: public function __toString(): string
28: {
29: if ($this->value instanceof DoctrineTagValueNode) {
30: return (string) $this->value;
31: }
32:
33: return trim("{$this->name} {$this->value}");
34: }
35:
36: }
37: