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\DependencyInjection\ExtensionInterface;
8: use PHPStan\Reflection\MethodReflection;
9: use PHPStan\Reflection\ParameterReflection;
10:
11: /**
12: * This is the interface for dynamically specifying the $this context
13: * for closure parameters in static method calls.
14: *
15: * To register it in the configuration file use the `phpstan.staticMethodParameterClosureThisExtension` service tag:
16: *
17: * ```
18: * services:
19: * -
20: * class: App\PHPStan\MyExtension
21: * tags:
22: * - phpstan.staticMethodParameterClosureThisExtension
23: * ```
24: *
25: * @api
26: */
27: #[ExtensionInterface(tag: 'phpstan.staticMethodParameterClosureThisExtension')]
28: interface StaticMethodParameterClosureThisExtension
29: {
30:
31: public function isStaticMethodSupported(MethodReflection $methodReflection, ParameterReflection $parameter): bool;
32:
33: public function getClosureThisTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, ParameterReflection $parameter, Scope $scope): ?Type;
34:
35: }
36: