parseType() public static method

Throws GraphQLError 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: typeFromAST().
public static parseType ( Source | string $source, array $options = [] ) : ListTypeNode | NameNode | NonNullTypeNode
$source Source | string
$options array
return GraphQL\Language\AST\ListTypeNode | GraphQL\Language\AST\NameNode | GraphQL\Language\AST\NonNullTypeNode
コード例 #1
0
ファイル: ParserTest.php プロジェクト: webonyx/graphql-php
 /**
  * @it parses nested types
  */
 public function testParsesNestedTypes()
 {
     $this->assertEquals(['kind' => NodeKind::LIST_TYPE, 'loc' => ['start' => 0, 'end' => 9], 'type' => ['kind' => NodeKind::NON_NULL_TYPE, 'loc' => ['start' => 1, 'end' => 8], 'type' => ['kind' => NodeKind::NAMED_TYPE, 'loc' => ['start' => 1, 'end' => 7], 'name' => ['kind' => NodeKind::NAME, 'loc' => ['start' => 1, 'end' => 7], 'value' => 'MyType']]]], $this->nodeToArray(Parser::parseType('[MyType!]')));
 }