src/ReflectionFile.php
private function findFileNamespaces()
    {
        $namespaces = array();

        // namespaces can be only top-level nodes, so we can scan them directly
        foreach ($this->topLevelNodes as $topLevelNode) {
            if ($topLevelNode instanceof Namespace_) {
                $namespaceName = $topLevelNode->name ? $topLevelNode->name->toString() : '';

                $namespaces[$namespaceName] = new ReflectionFileNamespace(
                    $this->fileName,
                    $namespaceName,
                    $topLevelNode
                );
            }
        }

        return $namespaces;
    }
private function findFileNamespaces()
    {
        $namespaces = array();

        // namespaces can be only top-level nodes, so we can scan them directly
        foreach ($this->topLevelNodes as $topLevelNode) {
            if ($topLevelNode instanceof Namespace_) {
                $namespaceName = $topLevelNode->name ? $topLevelNode->name->toString() : '';

                $namespaces[$namespaceName] = new ReflectionFileNamespace(
                    $this->fileName,
                    $namespaceName,
                    $topLevelNode
                );
            }
        }

        return $namespaces;
    }
private function findFileNamespaces ( ) { $ namespaces = array ( ) ; // namespaces can be only top-level nodes, so we can scan them directly foreach ( $ this -> topLevelNodes as $ topLevelNode ) { if ( $ topLevelNode instanceof Namespace_ ) { $ namespaceName = $ topLevelNode -> name ? $ topLevelNode -> name -> toString ( ) : '' ; $ namespaces [ $ namespaceName ] = new ReflectionFileNamespace ( $ this -> fileName , $ namespaceName , $ topLevelNode ) ; } } return $ namespaces ; }
Searches for file namespaces in the given AST

@return array|ReflectionFileNamespace[]
Searches for file namespaces in the given AST