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