| 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\Turbo\ShadowedByTurboExtension; |
| 9: | use PHPStan\Type\Generic\TemplateTypeMap; |
| 10: | use PHPStan\Type\Generic\TemplateTypeVarianceMap; |
| 11: | use PHPStan\Type\MixedType; |
| 12: | use PHPStan\Type\Type; |
| 13: | use function sprintf; |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | #[ShadowedByTurboExtension(implementation: __DIR__ . '/../../turbo-ext/src/TrivialParametersAcceptor.cpp')] |
| 19: | final class TrivialParametersAcceptor implements ExtendedParametersAcceptor, CallableParametersAcceptor |
| 20: | { |
| 21: | |
| 22: | |
| 23: | public function __construct(private string $callableName = 'callable') |
| 24: | { |
| 25: | } |
| 26: | |
| 27: | public function getTemplateTypeMap(): TemplateTypeMap |
| 28: | { |
| 29: | return TemplateTypeMap::createEmpty(); |
| 30: | } |
| 31: | |
| 32: | public function getResolvedTemplateTypeMap(): TemplateTypeMap |
| 33: | { |
| 34: | return TemplateTypeMap::createEmpty(); |
| 35: | } |
| 36: | |
| 37: | public function getCallSiteVarianceMap(): TemplateTypeVarianceMap |
| 38: | { |
| 39: | return TemplateTypeVarianceMap::createEmpty(); |
| 40: | } |
| 41: | |
| 42: | public function getParameters(): array |
| 43: | { |
| 44: | return []; |
| 45: | } |
| 46: | |
| 47: | public function isVariadic(): bool |
| 48: | { |
| 49: | return true; |
| 50: | } |
| 51: | |
| 52: | public function getReturnType(): Type |
| 53: | { |
| 54: | return new MixedType(); |
| 55: | } |
| 56: | |
| 57: | public function getPhpDocReturnType(): Type |
| 58: | { |
| 59: | return new MixedType(); |
| 60: | } |
| 61: | |
| 62: | public function getNativeReturnType(): Type |
| 63: | { |
| 64: | return new MixedType(); |
| 65: | } |
| 66: | |
| 67: | public function getThrowPoints(): array |
| 68: | { |
| 69: | return []; |
| 70: | } |
| 71: | |
| 72: | public function isPure(): TrinaryLogic |
| 73: | { |
| 74: | return TrinaryLogic::createMaybe(); |
| 75: | } |
| 76: | |
| 77: | public function getImpurePoints(): array |
| 78: | { |
| 79: | return [ |
| 80: | new SimpleImpurePoint( |
| 81: | 'functionCall', |
| 82: | sprintf('call to a %s', $this->callableName), |
| 83: | false, |
| 84: | ), |
| 85: | ]; |
| 86: | } |
| 87: | |
| 88: | public function getInvalidateExpressions(): array |
| 89: | { |
| 90: | return []; |
| 91: | } |
| 92: | |
| 93: | public function getUsedVariables(): array |
| 94: | { |
| 95: | return []; |
| 96: | } |
| 97: | |
| 98: | public function acceptsNamedArguments(): TrinaryLogic |
| 99: | { |
| 100: | return TrinaryLogic::createYes(); |
| 101: | } |
| 102: | |
| 103: | public function mustUseReturnValue(): TrinaryLogic |
| 104: | { |
| 105: | return TrinaryLogic::createMaybe(); |
| 106: | } |
| 107: | |
| 108: | public function getAsserts(): Assertions |
| 109: | { |
| 110: | return Assertions::createEmpty(); |
| 111: | } |
| 112: | |
| 113: | public function isStaticClosure(): TrinaryLogic |
| 114: | { |
| 115: | return TrinaryLogic::createMaybe(); |
| 116: | } |
| 117: | |
| 118: | } |
| 119: | |