src/Visitor/MutationsCollectorVisitor.php
private function getOuterMostArrayNode(Node $node): Node
    {
        $outerMostArrayParent = $node;

        do {
            if ($node instanceof Node\Expr\Array_) {
                $outerMostArrayParent = $node;
            }
        } while ($node = $node->getAttribute(ParentConnectorVisitor::PARENT_KEY));

        return $outerMostArrayParent;
    }
private function getOuterMostArrayNode(Node $node): Node
    {
        $outerMostArrayParent = $node;

        do {
            if ($node instanceof Node\Expr\Array_) {
                $outerMostArrayParent = $node;
            }
        } while ($node = $node->getAttribute(ParentConnectorVisitor::PARENT_KEY));

        return $outerMostArrayParent;
    }
private function getOuterMostArrayNode ( Node $ node ) : Node { $ outerMostArrayParent = $ node ; do { if ( $ node instanceof Node \ Expr \ Array_ ) { $ outerMostArrayParent = $ node ; } } while ( $ node = $ node -> getAttribute ( ParentConnectorVisitor :: PARENT_KEY ) ) ; return $ outerMostArrayParent ; }
If the node is part of an array, this will find the outermost array.
Otherwise this will return the node itself
If the node is part of an array this will find the outermost array . Otherwise this will return the node itself