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