private function parseTypeReference()
    {
        $start = $this->lexer->token;

        if ($this->skip(Token::BRACKET_L)) {
            $type = $this->parseTypeReference();
            $this->expect(Token::BRACKET_R);
            $type = new ListTypeNode([
                'type' => $type,
                'loc'  => $this->loc($start),
            ]);
        } else {
            $type = $this->parseNamedType();
        }
        if ($this->skip(Token::BANG)) {
            return new NonNullTypeNode([
                'type' => $type,
                'loc'  => $this->loc($start),
            ]);
        }

        return $type;
    }
private function parseTypeReference()
    {
        $start = $this->lexer->token;

        if ($this->skip(Token::BRACKET_L)) {
            $type = $this->parseTypeReference();
            $this->expect(Token::BRACKET_R);
            $type = new ListTypeNode([
                'type' => $type,
                'loc'  => $this->loc($start),
            ]);
        } else {
            $type = $this->parseNamedType();
        }
        if ($this->skip(Token::BANG)) {
            return new NonNullTypeNode([
                'type' => $type,
                'loc'  => $this->loc($start),
            ]);
        }

        return $type;
    }
private function parseTypeReference ( ) { $ start = $ this -> lexer -> token ; if ( $ this -> skip ( Token :: BRACKET_L ) ) { $ type = $ this -> parseTypeReference ( ) ; $ this -> expect ( Token :: BRACKET_R ) ; $ type = new ListTypeNode ( [ 'type' => $ type , 'loc' => $ this -> loc ( $ start ) , ] ) ; } else { $ type = $ this -> parseNamedType ( ) ; } if ( $ this -> skip ( Token :: BANG ) ) { return new NonNullTypeNode ( [ 'type' => $ type , 'loc' => $ this -> loc ( $ start ) , ] ) ; } return $ type ; }
Handles the Type: TypeName, ListType, and NonNullType parsing rules.

@return ListTypeNode|NameNode|NonNullTypeNode

@throws SyntaxError
Handles the Type : TypeName ListType and NonNullType parsing rules .