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