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;
}
/** * @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!]'))); }