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