private function extractUseStatement(\ArrayIterator $tokens)
    {
        $result = [''];
        while ($tokens->valid()
            && (self::T_LITERAL_USE_SEPARATOR !== $tokens->current()[0])
            && (self::T_LITERAL_END_OF_USE !== $tokens->current()[0])
        ) {
            if (T_AS === $tokens->current()[0]) {
                $result[] = '';
            }
            if (T_STRING === $tokens->current()[0] || T_NS_SEPARATOR === $tokens->current()[0]) {
                $result[\count($result) - 1] .= $tokens->current()[1];
            }
            $tokens->next();
        }

        if (1 == \count($result)) {
            $backslashPos = strrpos($result[0], '\\');

            if (false !== $backslashPos) {
                $result[] = substr($result[0], $backslashPos + 1);
            } else {
                $result[] = $result[0];
            }
        }

        return array_reverse($result);
    }
private function extractUseStatement(\ArrayIterator $tokens)
    {
        $result = [''];
        while ($tokens->valid()
            && (self::T_LITERAL_USE_SEPARATOR !== $tokens->current()[0])
            && (self::T_LITERAL_END_OF_USE !== $tokens->current()[0])
        ) {
            if (T_AS === $tokens->current()[0]) {
                $result[] = '';
            }
            if (T_STRING === $tokens->current()[0] || T_NS_SEPARATOR === $tokens->current()[0]) {
                $result[\count($result) - 1] .= $tokens->current()[1];
            }
            $tokens->next();
        }

        if (1 == \count($result)) {
            $backslashPos = strrpos($result[0], '\\');

            if (false !== $backslashPos) {
                $result[] = substr($result[0], $backslashPos + 1);
            } else {
                $result[] = $result[0];
            }
        }

        return array_reverse($result);
    }
private function extractUseStatement ( \ ArrayIterator $ tokens ) { $ result = [ '' ] ; while ( $ tokens -> valid ( ) && ( self :: T_LITERAL_USE_SEPARATOR !== $ tokens -> current ( ) [ 0 ] ) && ( self :: T_LITERAL_END_OF_USE !== $ tokens -> current ( ) [ 0 ] ) ) { if ( T_AS === $ tokens -> current ( ) [ 0 ] ) { $ result [ ] = '' ; } if ( T_STRING === $ tokens -> current ( ) [ 0 ] || T_NS_SEPARATOR === $ tokens -> current ( ) [ 0 ] ) { $ result [ \ count ( $ result ) - 1 ] .= $ tokens -> current ( ) [ 1 ] ; } $ tokens -> next ( ) ; } if ( 1 == \ count ( $ result ) ) { $ backslashPos = strrpos ( $ result [ 0 ] , '\\' ) ; if ( false !== $ backslashPos ) { $ result [ ] = substr ( $ result [ 0 ] , $ backslashPos + 1 ) ; } else { $ result [ ] = $ result [ 0 ] ; } } return array_reverse ( $ result ) ; }
Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of
a USE statement yet.

@param \ArrayIterator $tokens

@return string
Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of a USE statement yet .