1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\PhpDocParser\Ast\Type; |
4: | |
5: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
6: | use function implode; |
7: | |
8: | class CallableTypeNode implements TypeNode |
9: | { |
10: | |
11: | use NodeAttributes; |
12: | |
13: | |
14: | public $identifier; |
15: | |
16: | |
17: | public $parameters; |
18: | |
19: | |
20: | public $returnType; |
21: | |
22: | public function __construct(IdentifierTypeNode $identifier, array $parameters, TypeNode $returnType) |
23: | { |
24: | $this->identifier = $identifier; |
25: | $this->parameters = $parameters; |
26: | $this->returnType = $returnType; |
27: | } |
28: | |
29: | |
30: | public function __toString(): string |
31: | { |
32: | $parameters = implode(', ', $this->parameters); |
33: | return "{$this->identifier}({$parameters}): {$this->returnType}"; |
34: | } |
35: | |
36: | } |
37: | |