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