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: * @api
11: */
12: class FunctionVariant implements ParametersAcceptor
13: {
14:
15: private TemplateTypeVarianceMap $callSiteVarianceMap;
16:
17: /**
18: * @api
19: * @param list<ParameterReflection> $parameters
20: */
21: public function __construct(
22: private TemplateTypeMap $templateTypeMap,
23: private ?TemplateTypeMap $resolvedTemplateTypeMap,
24: private array $parameters,
25: private bool $isVariadic,
26: private Type $returnType,
27: ?TemplateTypeVarianceMap $callSiteVarianceMap = null,
28: )
29: {
30: $this->callSiteVarianceMap = $callSiteVarianceMap ?? TemplateTypeVarianceMap::createEmpty();
31: }
32:
33: public function getTemplateTypeMap(): TemplateTypeMap
34: {
35: return $this->templateTypeMap;
36: }
37:
38: public function getResolvedTemplateTypeMap(): TemplateTypeMap
39: {
40: return $this->resolvedTemplateTypeMap ?? TemplateTypeMap::createEmpty();
41: }
42:
43: public function getCallSiteVarianceMap(): TemplateTypeVarianceMap
44: {
45: return $this->callSiteVarianceMap;
46: }
47:
48: /**
49: * @return list<ParameterReflection>
50: */
51: public function getParameters(): array
52: {
53: return $this->parameters;
54: }
55:
56: public function isVariadic(): bool
57: {
58: return $this->isVariadic;
59: }
60:
61: public function getReturnType(): Type
62: {
63: return $this->returnType;
64: }
65:
66: }
67: