Automattic\WooCommerce\Vendor\GraphQL\Language
Parser::parseFieldsDefinition
Method of the class: Parser{}
No Hooks.
Returns
NodeList<FieldDefinitionNode>.
Usage
// private - for code of main (parent) class only $result = $this->parseFieldsDefinition(): NodeList;
Parser::parseFieldsDefinition() Parser::parseFieldsDefinition code WC 11.0.1
private function parseFieldsDefinition(): NodeList
{
// Legacy support for the SDL?
if (
($this->lexer->options['allowLegacySDLEmptyFields'] ?? false)
&& $this->peek(Token::BRACE_L)
&& $this->lexer->lookahead()->kind === Token::BRACE_R
) {
$this->lexer->advance();
$this->lexer->advance();
/** @phpstan-var NodeList<FieldDefinitionNode> $nodeList */
$nodeList = new NodeList([]);
} else {
/** @phpstan-var NodeList<FieldDefinitionNode> $nodeList */
$nodeList = $this->peek(Token::BRACE_L)
? $this->many(
Token::BRACE_L,
fn (): FieldDefinitionNode => $this->parseFieldDefinition(),
Token::BRACE_R
)
: new NodeList([]);
}
return $nodeList;
}