| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\PhpDocParser\Ast\PhpDoc; |
| 4: | |
| 5: | use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode; |
| 6: | use PHPStan\PhpDocParser\Ast\Node; |
| 7: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
| 8: | use PHPStan\PhpDocParser\Ast\Type\TypeNode; |
| 9: | |
| 10: | class MethodTagValueParameterNode implements Node |
| 11: | { |
| 12: | |
| 13: | use NodeAttributes; |
| 14: | |
| 15: | |
| 16: | public $type; |
| 17: | |
| 18: | |
| 19: | public $isReference; |
| 20: | |
| 21: | |
| 22: | public $isVariadic; |
| 23: | |
| 24: | |
| 25: | public $parameterName; |
| 26: | |
| 27: | |
| 28: | public $defaultValue; |
| 29: | |
| 30: | public function __construct(?TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, ?ConstExprNode $defaultValue) |
| 31: | { |
| 32: | $this->type = $type; |
| 33: | $this->isReference = $isReference; |
| 34: | $this->isVariadic = $isVariadic; |
| 35: | $this->parameterName = $parameterName; |
| 36: | $this->defaultValue = $defaultValue; |
| 37: | } |
| 38: | |
| 39: | |
| 40: | public function __toString(): string |
| 41: | { |
| 42: | $type = $this->type !== null ? "{$this->type} " : ''; |
| 43: | $isReference = $this->isReference ? '&' : ''; |
| 44: | $isVariadic = $this->isVariadic ? '...' : ''; |
| 45: | $default = $this->defaultValue !== null ? " = {$this->defaultValue}" : ''; |
| 46: | return "{$type}{$isReference}{$isVariadic}{$this->parameterName}{$default}"; |
| 47: | } |
| 48: | |
| 49: | } |
| 50: | |