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