/var/www/cobraambalaj/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor
Edit: /var/www/cobraambalaj/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php (865B)
$node->getAttribute('parent').
*/
final class ParentConnectingVisitor extends NodeVisitorAbstract
{
/**
* @var Node[]
*/
private $stack = [];
public function beforeTraverse(array $nodes)
{
$this->stack = [];
}
public function enterNode(Node $node)
{
if (!empty($this->stack)) {
$node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
}
$this->stack[] = $node;
}
public function leaveNode(Node $node)
{
array_pop($this->stack);
}
}