1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Reflection; |
4: | |
5: | use PHPStan\Type\Generic\TemplateTypeMap; |
6: | use PHPStan\Type\Generic\TemplateTypeVarianceMap; |
7: | use PHPStan\Type\Type; |
8: | |
9: | |
10: | class FunctionVariant implements ParametersAcceptor |
11: | { |
12: | |
13: | private TemplateTypeVarianceMap $callSiteVarianceMap; |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | public function __construct( |
20: | private TemplateTypeMap $templateTypeMap, |
21: | private ?TemplateTypeMap $resolvedTemplateTypeMap, |
22: | private array $parameters, |
23: | private bool $isVariadic, |
24: | private Type $returnType, |
25: | ?TemplateTypeVarianceMap $callSiteVarianceMap = null, |
26: | ) |
27: | { |
28: | $this->callSiteVarianceMap = $callSiteVarianceMap ?? TemplateTypeVarianceMap::createEmpty(); |
29: | } |
30: | |
31: | public function getTemplateTypeMap(): TemplateTypeMap |
32: | { |
33: | return $this->templateTypeMap; |
34: | } |
35: | |
36: | public function getResolvedTemplateTypeMap(): TemplateTypeMap |
37: | { |
38: | return $this->resolvedTemplateTypeMap ?? TemplateTypeMap::createEmpty(); |
39: | } |
40: | |
41: | public function getCallSiteVarianceMap(): TemplateTypeVarianceMap |
42: | { |
43: | return $this->callSiteVarianceMap; |
44: | } |
45: | |
46: | |
47: | |
48: | |
49: | public function getParameters(): array |
50: | { |
51: | return $this->parameters; |
52: | } |
53: | |
54: | public function isVariadic(): bool |
55: | { |
56: | return $this->isVariadic; |
57: | } |
58: | |
59: | public function getReturnType(): Type |
60: | { |
61: | return $this->returnType; |
62: | } |
63: | |
64: | } |
65: | |