| @@ 196-214 (lines=19) @@ | ||
| 193 | return new SelectionInlineFragment($typeCondition, $directives, $selectionSet, $location); |
|
| 194 | } |
|
| 195 | ||
| 196 | private function parseSelection() |
|
| 197 | { |
|
| 198 | if ($this->is(Token::T_SPREAD)) { |
|
| 199 | return $this->parseFragment(); |
|
| 200 | } |
|
| 201 | ||
| 202 | if ($this->is(Token::T_NAME)) { |
|
| 203 | return $this->parseField(); |
|
| 204 | } |
|
| 205 | ||
| 206 | $message = 'Expected a field, a fragment spread or an inline fragment'; |
|
| 207 | ||
| 208 | if ($this->scanner->eof()) { |
|
| 209 | throw $this->getParseError($message . ' but instead reached end'); |
|
| 210 | } |
|
| 211 | ||
| 212 | $token = $this->scanner->peek(); |
|
| 213 | throw $this->getParseError($message . " but instead found \"{$token->getName()}\" with value \"{$token->value}\""); |
|
| 214 | } |
|
| 215 | ||
| 216 | private function parseSelectionSet() |
|
| 217 | { |
|
| @@ 48-70 (lines=23) @@ | ||
| 45 | return $type; |
|
| 46 | } |
|
| 47 | ||
| 48 | private function parseType() |
|
| 49 | { |
|
| 50 | if ($this->is(Token::T_BRACKET_LEFT)) { |
|
| 51 | return $this->maybeParseNullType( |
|
| 52 | $this->parseListType() |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | ||
| 56 | if ($this->is(Token::T_NAME)) { |
|
| 57 | return $this->maybeParseNullType( |
|
| 58 | $this->parseNamedType() |
|
| 59 | ); |
|
| 60 | } |
|
| 61 | ||
| 62 | $message = 'Expected a type'; |
|
| 63 | ||
| 64 | if ($this->scanner->eof()) { |
|
| 65 | throw $this->getParseError($message . ' but instead reached end'); |
|
| 66 | } |
|
| 67 | ||
| 68 | $token = $this->scanner->peek(); |
|
| 69 | throw $this->getParseError($message . " but instead found \"{$token->getName()}\" with value \"{$token->value}\""); |
|
| 70 | } |
|
| 71 | ||
| 72 | private function parseObject() |
|
| 73 | { |
|