function NodeConnectingVisitor::enterNode
Overrides NodeVisitorAbstract::enterNode
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ NodeVisitor/ NodeConnectingVisitor.php, line 33
Class
- NodeConnectingVisitor
- Visitor that connects a child node to its parent node as well as its sibling nodes.
Namespace
PhpParser\NodeVisitorCode
public function enterNode(Node $node) {
if (!empty($this->stack)) {
$node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
}
if ($this->previous !== null && $this->previous
->getAttribute('parent') === $node->getAttribute('parent')) {
$node->setAttribute('previous', $this->previous);
$this->previous
->setAttribute('next', $node);
}
$this->stack[] = $node;
}