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