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