public static function getRoot(NodeInterface $parent): ?PhpFileModelInterface
    {
        while ($parent !== null) {
            if ($parent instanceof PhpFileModelInterface) {
                return $parent;
            }
            $parent = $parent->getParentNode();
        }
        return null;
    }
public static function getRoot(NodeInterface $parent): ?PhpFileModelInterface
    {
        while ($parent !== null) {
            if ($parent instanceof PhpFileModelInterface) {
                return $parent;
            }
            $parent = $parent->getParentNode();
        }
        return null;
    }
public static function getRoot ( NodeInterface $ parent ) : ? PhpFileModelInterface { while ( $ parent !== null ) { if ( $ parent instanceof PhpFileModelInterface ) { return $ parent ; } $ parent = $ parent -> getParentNode ( ) ; } return null ; }
Get the root of the node.

@param NodeInterface $parent The node to search in.

@return PhpFileModelInterface|null The root if it is found, else null.
Get the root of the node .