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