1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\PhpDoc;
4:
5: use PHPStan\Analyser\NameScope;
6: use PHPStan\DependencyInjection\ExtensionInterface;
7: use PHPStan\PhpDocParser\Ast\Type\TypeNode;
8: use PHPStan\Type\Type;
9:
10: /**
11: * This is the interface type node resolver extensions implement for custom PHPDoc types.
12: *
13: * To register it in the configuration file use the `phpstan.phpDoc.typeNodeResolverExtension` service tag:
14: *
15: * ```
16: * services:
17: * -
18: * class: App\PHPStan\MyExtension
19: * tags:
20: * - phpstan.phpDoc.typeNodeResolverExtension
21: * ```
22: *
23: * Learn more: https://phpstan.org/developing-extensions/custom-phpdoc-types
24: *
25: * @api
26: */
27: #[ExtensionInterface(tag: self::EXTENSION_TAG)]
28: interface TypeNodeResolverExtension
29: {
30:
31: public const EXTENSION_TAG = 'phpstan.phpDoc.typeNodeResolverExtension';
32:
33: public function resolve(TypeNode $typeNode, NameScope $nameScope): ?Type;
34:
35: }
36: