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