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