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