1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Collectors; |
4: | |
5: | use PhpParser\Node; |
6: | use PHPStan\Analyser\Scope; |
7: | |
8: | /** |
9: | * This is the interface custom collectors implement. To register it in the configuration file |
10: | * use the `phpstan.collector` service tag: |
11: | * |
12: | * ``` |
13: | * services: |
14: | * - |
15: | * class: App\MyCollector |
16: | * tags: |
17: | * - phpstan.collector |
18: | * ``` |
19: | * |
20: | * Learn more: https://phpstan.org/developing-extensions/collectors |
21: | * |
22: | * @api |
23: | * @phpstan-template-covariant TNodeType of Node |
24: | * @phpstan-template-covariant TValue |
25: | */ |
26: | interface Collector |
27: | { |
28: | |
29: | /** |
30: | * @phpstan-return class-string<TNodeType> |
31: | */ |
32: | public function getNodeType(): string; |
33: | |
34: | /** |
35: | * @phpstan-param TNodeType $node |
36: | * @return TValue|null Collected data |
37: | */ |
38: | public function processNode(Node $node, Scope $scope); |
39: | |
40: | } |
41: |