Throws GraphQLError if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Values directly and
in isolation of complete GraphQL documents.
Consider providing the results to the utility function: valueFromAST().
public static parseValue ( |
||
$source | ||
$options | array | |
return |
/** * @it parses list values */ public function testParsesListValues() { $this->assertEquals(['kind' => NodeKind::LST, 'loc' => ['start' => 0, 'end' => 11], 'values' => [['kind' => NodeKind::INT, 'loc' => ['start' => 1, 'end' => 4], 'value' => '123'], ['kind' => NodeKind::STRING, 'loc' => ['start' => 5, 'end' => 10], 'value' => 'abc']]], $this->nodeToArray(Parser::parseValue('[123 "abc"]'))); }
private function runTestCaseWithVars($variables, $type, $valueText, $expected) { $this->assertEquals($expected, AST::valueFromAST(Parser::parseValue($valueText), $type, $variables)); }