1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Type;
4:
5: use PhpParser\Node\Expr\MethodCall;
6: use PHPStan\Analyser\DependencyTracker;
7: use PHPStan\Analyser\Scope;
8: use PHPStan\DependencyInjection\ExtensionInterface;
9: use PHPStan\Reflection\MethodReflection;
10: use PHPStan\Reflection\ParameterReflection;
11:
12: /**
13: * This is the interface for dynamically specifying the $this context
14: * for closure parameters in method calls.
15: *
16: * To register it in the configuration file use the `phpstan.methodParameterClosureThisExtension` service tag:
17: *
18: * ```
19: * services:
20: * -
21: * class: App\PHPStan\MyExtension
22: * tags:
23: * - phpstan.methodParameterClosureThisExtension
24: * ```
25: *
26: * @api
27: */
28: #[ExtensionInterface(tag: 'phpstan.methodParameterClosureThisExtension')]
29: interface MethodParameterClosureThisExtension
30: {
31:
32: public function isMethodSupported(MethodReflection $methodReflection, ParameterReflection $parameter): bool;
33:
34: public function getClosureThisTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, ParameterReflection $parameter, Scope&DependencyTracker $scope): ?Type;
35:
36: }
37: