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