@@ 241-259 (lines=19) @@ | ||
238 | return new SelectionInlineFragment($typeCondition, $directives, $selectionSet); |
|
239 | } |
|
240 | ||
241 | private function parseSelection() |
|
242 | { |
|
243 | if ($this->is(Token::T_SPREAD)) { |
|
244 | return $this->parseFragment(); |
|
245 | } |
|
246 | ||
247 | if ($this->is(Token::T_NAME)) { |
|
248 | return $this->parseField(); |
|
249 | } |
|
250 | ||
251 | $message = 'Expected a field, a fragment spread or an inline fragment'; |
|
252 | ||
253 | if ($this->scanner->eof()) { |
|
254 | throw $this->getParseError($message . ' but instead reached end'); |
|
255 | } |
|
256 | ||
257 | $token = $this->scanner->peek(); |
|
258 | throw $this->getParseError($message . " but instead found \"{$token->getName()}\" with value \"{$token->value}\""); |
|
259 | } |
|
260 | ||
261 | private function parseSelectionSet() |
|
262 | { |
|
@@ 327-345 (lines=19) @@ | ||
324 | return $type; |
|
325 | } |
|
326 | ||
327 | private function parseType() |
|
328 | { |
|
329 | if ($this->is(Token::T_BRACKET_LEFT)) { |
|
330 | return $this->parseListType(); |
|
331 | } |
|
332 | ||
333 | if ($this->is(Token::T_NAME)) { |
|
334 | return $this->parseNamedType(); |
|
335 | } |
|
336 | ||
337 | $message = 'Expected a type'; |
|
338 | ||
339 | if ($this->scanner->eof()) { |
|
340 | throw $this->getParseError($message . ' but instead reached end'); |
|
341 | } |
|
342 | ||
343 | $token = $this->scanner->peek(); |
|
344 | throw $this->getParseError($message . " but instead found \"{$token->getName()}\" with value \"{$token->value}\""); |
|
345 | } |
|
346 | ||
347 | private function parseDirective() |
|
348 | { |