/** * @return \Fubhy\GraphQL\Language\Node\NamedType */ protected function parseNamedType() { $start = $this->token->getStart(); return new NamedType($this->parseName(), $this->location($start)); }
/** * If the next token is of the given kind, return that token after advancing * the parser. Otherwise, do not change the parser state and return false. * * @param int $type * * @return \Fubhy\GraphQL\Language\Token * * @throws \Exception */ protected function expect($type) { if ($this->token->getType() !== $type) { throw new \Exception(sprintf('Expected %s, found %s', Token::typeToString($type), (string) $this->token)); } $token = $this->token; $this->advance(); return $token; }