Skip to content

Commit a46b309

Browse files
committed
Move constants into NodeTraverser class
Not that the interface makes much sense anyway, but these are implementation details of a specific traverser.
1 parent f99a96e commit a46b309

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/PhpParser/NodeTraverser.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@
44

55
class NodeTraverser implements NodeTraverserInterface
66
{
7+
/**
8+
* If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes
9+
* of the current node will not be traversed for any visitors.
10+
*
11+
* For subsequent visitors enterNode() will still be called on the current
12+
* node and leaveNode() will also be invoked for the current node.
13+
*/
14+
const DONT_TRAVERSE_CHILDREN = 1;
15+
16+
/**
17+
* If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs
18+
* in an array, it will be removed from the array.
19+
*
20+
* For subsequent visitors leaveNode() will still be invoked for the
21+
* removed node.
22+
*/
23+
const REMOVE_NODE = false;
24+
725
/** @var NodeVisitor[] Visitors */
826
protected $visitors;
927

lib/PhpParser/NodeTraverserInterface.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,6 @@
44

55
interface NodeTraverserInterface
66
{
7-
/**
8-
* If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes
9-
* of the current node will not be traversed for any visitors.
10-
*
11-
* For subsequent visitors enterNode() will still be called on the current
12-
* node and leaveNode() will also be invoked for the current node.
13-
*/
14-
const DONT_TRAVERSE_CHILDREN = 1;
15-
16-
/**
17-
* If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs
18-
* in an array, it will be removed from the array.
19-
*
20-
* For subsequent visitors leaveNode() will still be invoked for the
21-
* removed node.
22-
*/
23-
const REMOVE_NODE = false;
24-
257
/**
268
* Adds a visitor.
279
*

0 commit comments

Comments
 (0)