Automattic\WooCommerce\Vendor\GraphQL\Language

Parser::parseUnionTypeDefinitionprivateWC 1.0

UnionTypeDefinition :

  • Description? union Name Directives[Const]? UnionMemberTypes?

Method of the class: Parser{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Parser::parseUnionTypeDefinition() code WC 11.0.1

private function parseUnionTypeDefinition(): UnionTypeDefinitionNode
{
    $start = $this->lexer->token;
    $description = $this->parseDescription();
    $this->expectKeyword('union');
    $name = $this->parseName();
    $directives = $this->parseDirectives(true);
    $types = $this->parseUnionMemberTypes();

    return new UnionTypeDefinitionNode([
        'name' => $name,
        'directives' => $directives,
        'types' => $types,
        'loc' => $this->loc($start),
        'description' => $description,
    ]);
}