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: public ?TypeNode $type = null;
16:
17: public bool $isReference;
18:
19: public bool $isVariadic;
20:
21: public string $parameterName;
22:
23: public ?ConstExprNode $defaultValue = null;
24:
25: public function __construct(?TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, ?ConstExprNode $defaultValue)
26: {
27: $this->type = $type;
28: $this->isReference = $isReference;
29: $this->isVariadic = $isVariadic;
30: $this->parameterName = $parameterName;
31: $this->defaultValue = $defaultValue;
32: }
33:
34:
35: public function __toString(): string
36: {
37: $type = $this->type !== null ? "{$this->type} " : '';
38: $isReference = $this->isReference ? '&' : '';
39: $isVariadic = $this->isVariadic ? '...' : '';
40: $default = $this->defaultValue !== null ? " = {$this->defaultValue}" : '';
41: return "{$type}{$isReference}{$isVariadic}{$this->parameterName}{$default}";
42: }
43:
44: }
45: