Automattic\WooCommerce\Vendor\GraphQL\Language
Parser::expectKeyword
If the next token is a keyword with the given value, advance the lexer. Otherwise, throw an error.
Method of the class: Parser{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->expectKeyword( $value ): void;
- $value(string) (required)
- .
Parser::expectKeyword() Parser::expectKeyword code WC 11.0.1
private function expectKeyword(string $value): void
{
$token = $this->lexer->token;
if ($token->kind !== Token::NAME || $token->value !== $value) {
throw new SyntaxError($this->lexer->source, $token->start, "Expected \"{$value}\", found {$token->getDescription()}");
}
$this->lexer->advance();
}