| 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 ParamTagValueNode implements PhpDocTagValueNode |
| 10: | { |
| 11: | |
| 12: | use NodeAttributes; |
| 13: | |
| 14: | public TypeNode $type; |
| 15: | |
| 16: | public bool $isReference; |
| 17: | |
| 18: | public bool $isVariadic; |
| 19: | |
| 20: | public string $parameterName; |
| 21: | |
| 22: | |
| 23: | public string $description; |
| 24: | |
| 25: | public function __construct(TypeNode $type, bool $isVariadic, string $parameterName, string $description, bool $isReference) |
| 26: | { |
| 27: | $this->type = $type; |
| 28: | $this->isReference = $isReference; |
| 29: | $this->isVariadic = $isVariadic; |
| 30: | $this->parameterName = $parameterName; |
| 31: | $this->description = $description; |
| 32: | } |
| 33: | |
| 34: | |
| 35: | public function __toString(): string |
| 36: | { |
| 37: | $reference = $this->isReference ? '&' : ''; |
| 38: | $variadic = $this->isVariadic ? '...' : ''; |
| 39: | return trim("{$this->type} {$reference}{$variadic}{$this->parameterName} {$this->description}"); |
| 40: | } |
| 41: | |
| 42: | } |
| 43: | |