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