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\Analyser\SpecifiedTypes;
9: use PHPStan\Analyser\TypeSpecifierContext;
10: use PHPStan\Analyser\TypeSpecifierFactory;
11: use PHPStan\DependencyInjection\ExtensionInterface;
12: use PHPStan\Reflection\MethodReflection;
13:
14: /**
15: * This is the interface type-specifying extensions implement for static methods.
16: *
17: * To register it in the configuration file use the `phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension` service tag:
18: *
19: * ```
20: * services:
21: * -
22: * class: App\PHPStan\MyExtension
23: * tags:
24: * - phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension
25: * ```
26: *
27: * Learn more: https://phpstan.org/developing-extensions/type-specifying-extensions
28: *
29: * @api
30: */
31: #[ExtensionInterface(tag: TypeSpecifierFactory::STATIC_METHOD_TYPE_SPECIFYING_EXTENSION_TAG)]
32: interface StaticMethodTypeSpecifyingExtension
33: {
34:
35: /** @return class-string */
36: public function getClass(): string;
37:
38: public function isStaticMethodSupported(MethodReflection $staticMethodReflection, StaticCall $node, TypeSpecifierContext $context): bool;
39:
40: public function specifyTypes(MethodReflection $staticMethodReflection, StaticCall $node, Scope&DependencyTracker $scope, TypeSpecifierContext $context): SpecifiedTypes;
41:
42: }
43: