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: | public string $name; |
15: | |
16: | public PhpDocTagValueNode $value; |
17: | |
18: | public function __construct(string $name, PhpDocTagValueNode $value) |
19: | { |
20: | $this->name = $name; |
21: | $this->value = $value; |
22: | } |
23: | |
24: | |
25: | public function __toString(): string |
26: | { |
27: | if ($this->value instanceof DoctrineTagValueNode) { |
28: | return (string) $this->value; |
29: | } |
30: | |
31: | return trim("{$this->name} {$this->value}"); |
32: | } |
33: | |
34: | } |
35: | |