1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\PhpDocParser\Ast\PhpDoc; |
4: | |
5: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
6: | use function trim; |
7: | |
8: | class TypelessParamTagValueNode implements PhpDocTagValueNode |
9: | { |
10: | |
11: | use NodeAttributes; |
12: | |
13: | |
14: | public $isReference; |
15: | |
16: | |
17: | public $isVariadic; |
18: | |
19: | |
20: | public $parameterName; |
21: | |
22: | |
23: | public $description; |
24: | |
25: | public function __construct(bool $isVariadic, string $parameterName, string $description, bool $isReference = false) |
26: | { |
27: | $this->isReference = $isReference; |
28: | $this->isVariadic = $isVariadic; |
29: | $this->parameterName = $parameterName; |
30: | $this->description = $description; |
31: | } |
32: | |
33: | |
34: | public function __toString(): string |
35: | { |
36: | $reference = $this->isReference ? '&' : ''; |
37: | $variadic = $this->isVariadic ? '...' : ''; |
38: | return trim("{$reference}{$variadic}{$this->parameterName} {$this->description}"); |
39: | } |
40: | |
41: | } |
42: | |