src/Language/Parser.php
public static function parseType($source, array $options = [])
    {
        $sourceObj = $source instanceof Source ? $source : new Source($source);
        $parser    = new Parser($sourceObj, $options);
        $parser->expect(Token::SOF);
        $type = $parser->parseTypeReference();
        $parser->expect(Token::EOF);

        return $type;
    }
public static function parseType($source, array $options = [])
    {
        $sourceObj = $source instanceof Source ? $source : new Source($source);
        $parser    = new Parser($sourceObj, $options);
        $parser->expect(Token::SOF);
        $type = $parser->parseTypeReference();
        $parser->expect(Token::EOF);

        return $type;
    }
public static function parseType ( $ source , array $ options = [ ] ) { $ sourceObj = $ source instanceof Source ? $ source : new Source ( $ source ) ; $ parser = new Parser ( $ sourceObj , $ options ) ; $ parser -> expect ( Token :: SOF ) ; $ type = $ parser -> parseTypeReference ( ) ; $ parser -> expect ( Token :: EOF ) ; return $ type ; }
Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for
that type.
Throws `GraphQL\Error\SyntaxError` if a syntax error is encountered.

This is useful within tools that operate upon GraphQL Types directly and
in isolation of complete GraphQL documents.

Consider providing the results to the utility function: `GraphQL\Utils\AST::typeFromAST()`.

@param Source|string $source
@param bool[]        $options

@return ListTypeNode|NameNode|NonNullTypeNode

@api
Given a string containing a GraphQL Type ( ex . [ Int! ] ) parse the AST for that type . Throws GraphQL \ Error \ SyntaxError if a syntax error is encountered .