GraphQL\Language\Parser::parse PHP Method

parse() public static method

noLocation: boolean, (By default, the parser creates AST nodes that know the location in the source that they correspond to. This configuration flag disables that behavior for performance or testing.)
public static parse ( Source | string $source, array $options = [] ) : DocumentNode
$source Source | string
$options array
return GraphQL\Language\AST\DocumentNode
    public static function parse($source, array $options = [])
    {
        $sourceObj = $source instanceof Source ? $source : new Source($source);
        $parser = new self($sourceObj, $options);
        return $parser->parseDocument();
    }

Usage Example

Exemplo n.º 1
0
 function expectInvalid($schema, $rules, $queryString, $errors)
 {
     $result = DocumentValidator::validate($schema, Parser::parse($queryString), $rules);
     $this->assertEquals(false, $result['isValid'], 'GraphQL should not validate');
     $this->assertEquals($errors, $result['errors']);
     return $result;
 }
All Usage Examples Of GraphQL\Language\Parser::parse