src/Eloquent/Typhoon/ClassMapper/ClassMapper.php
protected function parseUsedClass(array &$tokens)
    {
        $this->typeCheck->parseUsedClass(func_get_args());

        $usedClassTuple = array();
        $usedClassAtoms = array();

        $token = next($tokens);
        while (
            is_array($token) && (
                T_STRING === $token[0] ||
                T_NS_SEPARATOR === $token[0] ||
                T_WHITESPACE === $token[0]
            )
        ) {
            if (T_STRING === $token[0]) {
                $usedClassAtoms[] .= $token[1];
            }

            $token = next($tokens);
        }
        $usedClassTuple[] = ClassName::fromAtoms($usedClassAtoms, true);

        if (
            !is_array($token) ||
            T_AS !== $token[0]
        ) {
            return $usedClassTuple;
        }

        $token = next($tokens);
        while (
            is_array($token) &&
            T_WHITESPACE === $token[0]
        ) {
            $token = next($tokens);
        }

        if (
            is_array($token) &&
            T_STRING === $token[0]
        ) {
            $usedClassTuple[] = ClassName::fromAtoms(array($token[1]), false);
        }

        return $usedClassTuple;
    }
protected function parseUsedClass(array &$tokens)
    {
        $this->typeCheck->parseUsedClass(func_get_args());

        $usedClassTuple = array();
        $usedClassAtoms = array();

        $token = next($tokens);
        while (
            is_array($token) && (
                T_STRING === $token[0] ||
                T_NS_SEPARATOR === $token[0] ||
                T_WHITESPACE === $token[0]
            )
        ) {
            if (T_STRING === $token[0]) {
                $usedClassAtoms[] .= $token[1];
            }

            $token = next($tokens);
        }
        $usedClassTuple[] = ClassName::fromAtoms($usedClassAtoms, true);

        if (
            !is_array($token) ||
            T_AS !== $token[0]
        ) {
            return $usedClassTuple;
        }

        $token = next($tokens);
        while (
            is_array($token) &&
            T_WHITESPACE === $token[0]
        ) {
            $token = next($tokens);
        }

        if (
            is_array($token) &&
            T_STRING === $token[0]
        ) {
            $usedClassTuple[] = ClassName::fromAtoms(array($token[1]), false);
        }

        return $usedClassTuple;
    }
@param array<string|array> &$tokens

@return array<ClassName>