| 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: | |
| 15: | public $name; |
| 16: | |
| 17: | |
| 18: | public $bound; |
| 19: | |
| 20: | |
| 21: | public $default; |
| 22: | |
| 23: | |
| 24: | public $description; |
| 25: | |
| 26: | public function __construct(string $name, ?TypeNode $bound, string $description, ?TypeNode $default = null) |
| 27: | { |
| 28: | $this->name = $name; |
| 29: | $this->bound = $bound; |
| 30: | $this->default = $default; |
| 31: | $this->description = $description; |
| 32: | } |
| 33: | |
| 34: | |
| 35: | public function __toString(): string |
| 36: | { |
| 37: | $bound = $this->bound !== null ? " of {$this->bound}" : ''; |
| 38: | $default = $this->default !== null ? " = {$this->default}" : ''; |
| 39: | return trim("{$this->name}{$bound}{$default} {$this->description}"); |
| 40: | } |
| 41: | |
| 42: | } |
| 43: | |