src/Reflection/ReflectionFile.php
private function registerNamespace(int $tokenID)
    {
        $namespace = '';
        $localID = $tokenID + 1;

        do {
            $token = $this->tokens[$localID++];
            if ($token[self::TOKEN_CODE] == '{') {
                break;
            }

            $namespace .= $token[self::TOKEN_CODE];
        } while (
            isset($this->tokens[$localID])
            && $this->tokens[$localID][self::TOKEN_CODE] != '{'
            && $this->tokens[$localID][self::TOKEN_CODE] != ';'
        );

        //Whitespaces
        $namespace = trim($namespace);

        $uses = [];
        if (isset($this->namespaces[$namespace])) {
            $uses = $this->namespaces[$namespace];
        }

        if ($this->tokens[$localID][self::TOKEN_CODE] == ';') {
            $endingID = count($this->tokens) - 1;
        } else {
            $endingID = $this->endingToken($tokenID);
        }

        $this->namespaces[$namespace] = [
            self::O_TOKEN => $tokenID,
            self::C_TOKEN => $endingID,
            self::N_USES  => $uses,
        ];
    }
private function registerNamespace(int $tokenID)
    {
        $namespace = '';
        $localID = $tokenID + 1;

        do {
            $token = $this->tokens[$localID++];
            if ($token[self::TOKEN_CODE] == '{') {
                break;
            }

            $namespace .= $token[self::TOKEN_CODE];
        } while (
            isset($this->tokens[$localID])
            && $this->tokens[$localID][self::TOKEN_CODE] != '{'
            && $this->tokens[$localID][self::TOKEN_CODE] != ';'
        );

        //Whitespaces
        $namespace = trim($namespace);

        $uses = [];
        if (isset($this->namespaces[$namespace])) {
            $uses = $this->namespaces[$namespace];
        }

        if ($this->tokens[$localID][self::TOKEN_CODE] == ';') {
            $endingID = count($this->tokens) - 1;
        } else {
            $endingID = $this->endingToken($tokenID);
        }

        $this->namespaces[$namespace] = [
            self::O_TOKEN => $tokenID,
            self::C_TOKEN => $endingID,
            self::N_USES  => $uses,
        ];
    }
private function registerNamespace ( int $ tokenID ) { $ namespace = '' ; $ localID = $ tokenID + 1 ; do { $ token = $ this -> tokens [ $ localID ++ ] ; if ( $ token [ self :: TOKEN_CODE ] == '{' ) { break ; } $ namespace .= $ token [ self :: TOKEN_CODE ] ; } while ( isset ( $ this -> tokens [ $ localID ] ) && $ this -> tokens [ $ localID ] [ self :: TOKEN_CODE ] != '{' && $ this -> tokens [ $ localID ] [ self :: TOKEN_CODE ] != ';' ) ; //Whitespaces $ namespace = trim ( $ namespace ) ; $ uses = [ ] ; if ( isset ( $ this -> namespaces [ $ namespace ] ) ) { $ uses = $ this -> namespaces [ $ namespace ] ; } if ( $ this -> tokens [ $ localID ] [ self :: TOKEN_CODE ] == ';' ) { $ endingID = count ( $ this -> tokens ) - 1 ; } else { $ endingID = $ this -> endingToken ( $ tokenID ) ; } $ this -> namespaces [ $ namespace ] = [ self :: O_TOKEN => $ tokenID , self :: C_TOKEN => $ endingID , self :: N_USES => $ uses , ] ; }
Handle namespace declaration.

@param int $tokenID
Handle namespace declaration .