src/Parser.php
protected function _useNode()
    {
        $current = $this->_states['current'];
        $token = $this->_stream->current(true);
        $last = $alias = $use = '';
        $as = false;
        $stop = ';';
        $prefix = '';
        while ($token[1] !== $stop) {
            $this->_states['body'] .= $token[1];
            if (!$token = $this->_stream->next(true)) {
                break;
            }
            switch ($token[0]) {
                case ',':
                    $as ? $this->_states['uses'][$alias] = $prefix . $use : $this->_states['uses'][$last] = $prefix . $use;
                    $last = $alias = $use = '';
                    $as = false;
                break;
                case T_STRING:
                    $last = $token[1];
                case T_NS_SEPARATOR:
                    $as ? $alias .= $token[1] : $use .= $token[1];
                break;
                case T_AS:
                    $as = true;
                break;
                case '{':
                    $prefix = $use;
                    $use = '';
                    $stop = $current->type === 'class' ? '}' : ';';
                break;
            }
        }
        $this->_states['body'] .= $token[0];
        $as ? $this->_states['uses'][$alias] = $prefix . $use : $this->_states['uses'][$last] = $prefix . $use;
        $this->_codeNode('use');
    }
protected function _useNode()
    {
        $current = $this->_states['current'];
        $token = $this->_stream->current(true);
        $last = $alias = $use = '';
        $as = false;
        $stop = ';';
        $prefix = '';
        while ($token[1] !== $stop) {
            $this->_states['body'] .= $token[1];
            if (!$token = $this->_stream->next(true)) {
                break;
            }
            switch ($token[0]) {
                case ',':
                    $as ? $this->_states['uses'][$alias] = $prefix . $use : $this->_states['uses'][$last] = $prefix . $use;
                    $last = $alias = $use = '';
                    $as = false;
                break;
                case T_STRING:
                    $last = $token[1];
                case T_NS_SEPARATOR:
                    $as ? $alias .= $token[1] : $use .= $token[1];
                break;
                case T_AS:
                    $as = true;
                break;
                case '{':
                    $prefix = $use;
                    $use = '';
                    $stop = $current->type === 'class' ? '}' : ';';
                break;
            }
        }
        $this->_states['body'] .= $token[0];
        $as ? $this->_states['uses'][$alias] = $prefix . $use : $this->_states['uses'][$last] = $prefix . $use;
        $this->_codeNode('use');
    }
protected function _useNode ( ) { $ current = $ this -> _states [ 'current' ] ; $ token = $ this -> _stream -> current ( true ) ; $ last = $ alias = $ use = '' ; $ as = false ; $ stop = ';' ; $ prefix = '' ; while ( $ token [ 1 ] !== $ stop ) { $ this -> _states [ 'body' ] .= $ token [ 1 ] ; if ( ! $ token = $ this -> _stream -> next ( true ) ) { break ; } switch ( $ token [ 0 ] ) { case ',' : $ as ? $ this -> _states [ 'uses' ] [ $ alias ] = $ prefix . $ use : $ this -> _states [ 'uses' ] [ $ last ] = $ prefix . $ use ; $ last = $ alias = $ use = '' ; $ as = false ; break ; case T_STRING : $ last = $ token [ 1 ] ; case T_NS_SEPARATOR : $ as ? $ alias .= $ token [ 1 ] : $ use .= $ token [ 1 ] ; break ; case T_AS : $ as = true ; break ; case '{' : $ prefix = $ use ; $ use = '' ; $ stop = $ current -> type === 'class' ? '}' : ';' ; break ; } } $ this -> _states [ 'body' ] .= $ token [ 0 ] ; $ as ? $ this -> _states [ 'uses' ] [ $ alias ] = $ prefix . $ use : $ this -> _states [ 'uses' ] [ $ last ] = $ prefix . $ use ; $ this -> _codeNode ( 'use' ) ; }
Manage use statement.
Manage use statement .