-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathRectorInterface.php
More file actions
35 lines (30 loc) · 1.04 KB
/
RectorInterface.php
File metadata and controls
35 lines (30 loc) · 1.04 KB
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
<?php
declare(strict_types=1);
namespace Rector\Contract\Rector;
use PhpParser\Node;
use PhpParser\NodeVisitor;
use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
interface RectorInterface extends NodeVisitor, DocumentedRuleInterface
{
/**
* List of nodes this class checks, classes that implements \PhpParser\Node
* See beautiful map of all nodes https://github.com/rectorphp/php-parser-nodes-docs#node-overview
*
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array;
/**
* Process Node of matched type
* @return Node|Node[]|null|int
*
* For int return, choose:
*
* ✔️ To decorate current node and its children to not be traversed on current rule, return one of:
* - NodeVisitor::DONT_TRAVERSE_CHILDREN
* - NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
*
* ✔️ To remove node of Node\Stmt or Node\Param, return:
* - NodeVisitor::REMOVE_NODE
*/
public function refactor(Node $node);
}