1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type; |
4: | |
5: | use PhpParser\Node\Expr; |
6: | use PHPStan\Analyser\Scope; |
7: | |
8: | /** |
9: | * To register it in the configuration file use the `phpstan.broker.expressionTypeResolverExtension` service tag: |
10: | * |
11: | * ``` |
12: | * services: |
13: | * - |
14: | * class: App\PHPStan\MyExtension |
15: | * tags: |
16: | * - phpstan.broker.expressionTypeResolverExtension |
17: | * ``` |
18: | * |
19: | * You should return null in your extension if you don't care about given Expr. |
20: | * |
21: | * @api |
22: | */ |
23: | interface ExpressionTypeResolverExtension |
24: | { |
25: | |
26: | public function getType(Expr $expr, Scope $scope): ?Type; |
27: | |
28: | } |
29: |