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\Type\TypeNode;
7: use function trim;
8:
9: class TemplateTagValueNode implements PhpDocTagValueNode
10: {
11:
12: use NodeAttributes;
13:
14: /** @var string */
15: public $name;
16:
17: /** @var TypeNode|null */
18: public $bound;
19:
20: /** @var string (may be empty) */
21: public $description;
22:
23: public function __construct(string $name, ?TypeNode $bound, string $description)
24: {
25: $this->name = $name;
26: $this->bound = $bound;
27: $this->description = $description;
28: }
29:
30:
31: public function __toString(): string
32: {
33: $bound = $this->bound !== null ? " of {$this->bound}" : '';
34: return trim("{$this->name}{$bound} {$this->description}");
35: }
36:
37: }
38: