49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace PhpParser;
|
|
|
|
interface NodeTraverserInterface
|
|
{
|
|
/**
|
|
* If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes
|
|
* of the current node will not be traversed for any visitors.
|
|
*
|
|
* For subsequent visitors enterNode() will still be called on the current
|
|
* node and leaveNode() will also be invoked for the current node.
|
|
*/
|
|
const DONT_TRAVERSE_CHILDREN = 1;
|
|
|
|
/**
|
|
* If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs
|
|
* in an array, it will be removed from the array.
|
|
*
|
|
* For subsequent visitors leaveNode() will still be invoked for the
|
|
* removed node.
|
|
*/
|
|
const REMOVE_NODE = false;
|
|
|
|
/**
|
|
* Adds a visitor.
|
|
*
|
|
* @param NodeVisitor $visitor Visitor to add
|
|
*/
|
|
function addVisitor(NodeVisitor $visitor);
|
|
|
|
/**
|
|
* Removes an added visitor.
|
|
*
|
|
* @param NodeVisitor $visitor
|
|
*/
|
|
function removeVisitor(NodeVisitor $visitor);
|
|
|
|
/**
|
|
* Traverses an array of nodes using the registered visitors.
|
|
*
|
|
* @param Node[] $nodes Array of nodes
|
|
*
|
|
* @return Node[] Traversed array of nodes
|
|
*/
|
|
function traverse(array $nodes);
|
|
}
|
|
|