1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Reflection; |
4: | |
5: | use PHPStan\Reflection\Callables\CallableParametersAcceptor; |
6: | use PHPStan\Reflection\Callables\SimpleImpurePoint; |
7: | use PHPStan\TrinaryLogic; |
8: | use PHPStan\Type\Generic\TemplateTypeMap; |
9: | use PHPStan\Type\Generic\TemplateTypeVarianceMap; |
10: | use PHPStan\Type\MixedType; |
11: | use PHPStan\Type\Type; |
12: | use function sprintf; |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | class TrivialParametersAcceptor implements ParametersAcceptorWithPhpDocs, CallableParametersAcceptor |
19: | { |
20: | |
21: | |
22: | public function __construct(private string $callableName = 'callable') |
23: | { |
24: | } |
25: | |
26: | public function getTemplateTypeMap(): TemplateTypeMap |
27: | { |
28: | return TemplateTypeMap::createEmpty(); |
29: | } |
30: | |
31: | public function getResolvedTemplateTypeMap(): TemplateTypeMap |
32: | { |
33: | return TemplateTypeMap::createEmpty(); |
34: | } |
35: | |
36: | public function getCallSiteVarianceMap(): TemplateTypeVarianceMap |
37: | { |
38: | return TemplateTypeVarianceMap::createEmpty(); |
39: | } |
40: | |
41: | public function getParameters(): array |
42: | { |
43: | return []; |
44: | } |
45: | |
46: | public function isVariadic(): bool |
47: | { |
48: | return true; |
49: | } |
50: | |
51: | public function getReturnType(): Type |
52: | { |
53: | return new MixedType(); |
54: | } |
55: | |
56: | public function getPhpDocReturnType(): Type |
57: | { |
58: | return new MixedType(); |
59: | } |
60: | |
61: | public function getNativeReturnType(): Type |
62: | { |
63: | return new MixedType(); |
64: | } |
65: | |
66: | public function getThrowPoints(): array |
67: | { |
68: | return []; |
69: | } |
70: | |
71: | public function isPure(): TrinaryLogic |
72: | { |
73: | return TrinaryLogic::createMaybe(); |
74: | } |
75: | |
76: | public function getImpurePoints(): array |
77: | { |
78: | return [ |
79: | new SimpleImpurePoint( |
80: | 'functionCall', |
81: | sprintf('call to a %s', $this->callableName), |
82: | false, |
83: | ), |
84: | ]; |
85: | } |
86: | |
87: | public function getInvalidateExpressions(): array |
88: | { |
89: | return []; |
90: | } |
91: | |
92: | public function getUsedVariables(): array |
93: | { |
94: | return []; |
95: | } |
96: | |
97: | public function acceptsNamedArguments(): bool |
98: | { |
99: | return true; |
100: | } |
101: | |
102: | } |
103: | |