forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodParameterClosureThisExtension.php
More file actions
35 lines (29 loc) · 1.02 KB
/
Copy pathMethodParameterClosureThisExtension.php
File metadata and controls
35 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php declare(strict_types = 1);
namespace PHPStan\Type;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\DependencyInjection\ExtensionInterface;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ParameterReflection;
/**
* This is the interface for dynamically specifying the $this context
* for closure parameters in method calls.
*
* To register it in the configuration file use the `phpstan.methodParameterClosureThisExtension` service tag:
*
* ```
* services:
* -
* class: App\PHPStan\MyExtension
* tags:
* - phpstan.methodParameterClosureThisExtension
* ```
*
* @api
*/
#[ExtensionInterface(tag: 'phpstan.methodParameterClosureThisExtension')]
interface MethodParameterClosureThisExtension
{
public function isMethodSupported(MethodReflection $methodReflection, ParameterReflection $parameter): bool;
public function getClosureThisTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, ParameterReflection $parameter, Scope $scope): ?Type;
}