1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Type;
4:
5: use PhpParser\Node\Expr\FuncCall;
6: use PHPStan\Analyser\Scope;
7: use PHPStan\DependencyInjection\ExtensionInterface;
8: use PHPStan\Reflection\FunctionReflection;
9:
10: /**
11: * This is the interface dynamic throw type extensions implement for functions.
12: *
13: * To register it in the configuration file use the `phpstan.dynamicFunctionThrowTypeExtension` service tag:
14: *
15: * ```
16: * services:
17: * -
18: * class: App\PHPStan\MyExtension
19: * tags:
20: * - phpstan.dynamicFunctionThrowTypeExtension
21: * ```
22: *
23: * Learn more: https://phpstan.org/developing-extensions/dynamic-throw-type-extensions
24: *
25: * @api
26: */
27: #[ExtensionInterface(tag: 'phpstan.dynamicFunctionThrowTypeExtension')]
28: interface DynamicFunctionThrowTypeExtension
29: {
30:
31: public function isFunctionSupported(FunctionReflection $functionReflection): bool;
32:
33: public function getThrowTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $funcCall, Scope $scope): ?Type;
34:
35: }
36: