Documentation

NodeTraverser
in package
implements NodeTraverserInterface

Table of Contents

Interfaces

NodeTraverserInterface

Constants

DONT_TRAVERSE_CHILDREN  = \PhpParser\NodeVisitor::DONT_TRAVERSE_CHILDREN
DONT_TRAVERSE_CURRENT_AND_CHILDREN  = \PhpParser\NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
REMOVE_NODE  = \PhpParser\NodeVisitor::REMOVE_NODE
STOP_TRAVERSAL  = \PhpParser\NodeVisitor::STOP_TRAVERSAL

Properties

$stopTraversal  : bool
$visitors  : array<int, NodeVisitor>

Methods

__construct()  : mixed
Create a traverser with the given visitors.
addVisitor()  : void
Adds a visitor.
removeVisitor()  : void
Removes an added visitor.
traverse()  : array<string|int, Node>
Traverses an array of nodes using the registered visitors.
traverseArray()  : array<string|int, mixed>
Recursively traverse array (usually of nodes).
traverseNode()  : void
Recursively traverse a node.
ensureReplacementReasonable()  : void

Constants

DONT_TRAVERSE_CHILDREN

public mixed DONT_TRAVERSE_CHILDREN = \PhpParser\NodeVisitor::DONT_TRAVERSE_CHILDREN
Tags
deprecated

Use NodeVisitor::DONT_TRAVERSE_CHILDREN instead.

DONT_TRAVERSE_CURRENT_AND_CHILDREN

public mixed DONT_TRAVERSE_CURRENT_AND_CHILDREN = \PhpParser\NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
Tags
deprecated

Use NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN instead.

REMOVE_NODE

public mixed REMOVE_NODE = \PhpParser\NodeVisitor::REMOVE_NODE
Tags
deprecated

Use NodeVisitor::REMOVE_NODE instead.

STOP_TRAVERSAL

public mixed STOP_TRAVERSAL = \PhpParser\NodeVisitor::STOP_TRAVERSAL
Tags
deprecated

Use NodeVisitor::STOP_TRAVERSAL instead.

Properties

$stopTraversal

protected bool $stopTraversal

Whether traversal should be stopped

Methods

traverse()

Traverses an array of nodes using the registered visitors.

public traverse(array<string|int, Node$nodes) : array<string|int, Node>
Parameters
$nodes : array<string|int, Node>

Array of nodes

Return values
array<string|int, Node>

Traversed array of nodes

traverseArray()

Recursively traverse array (usually of nodes).

protected traverseArray(array<string|int, mixed> $nodes) : array<string|int, mixed>
Parameters
$nodes : array<string|int, mixed>

Array to traverse

Return values
array<string|int, mixed>

Result of traversal (may be original array or changed one)

traverseNode()

Recursively traverse a node.

protected traverseNode(Node $node) : void
Parameters
$node : Node

Node to traverse.


        
On this page

Search results