Automattic\WooCommerce\Vendor\GraphQL\Language

Parser::parseVariableDefinitionprivateWC 1.0

Method of the class: Parser{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->parseVariableDefinition(): VariableDefinitionNode;

Parser::parseVariableDefinition() code WC 11.0.1

private function parseVariableDefinition(): VariableDefinitionNode
{
    $start = $this->lexer->token;
    $var = $this->parseVariable();

    $this->expect(Token::COLON);
    $type = $this->parseTypeReference();

    return new VariableDefinitionNode([
        'variable' => $var,
        'type' => $type,
        'defaultValue' => $this->skip(Token::EQUALS)
            ? $this->parseValueLiteral(true)
            : null,
        'directives' => $this->parseDirectives(true),
        'loc' => $this->loc($start),
    ]);
}