Automattic\WooCommerce\Vendor\GraphQL\Language

Parser::parseUnionTypeExtensionprivateWC 1.0

UnionTypeExtension :

  • extend union Name Directives[Const]? UnionMemberTypes
  • extend union Name Directives[Const].

Method of the class: Parser{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Parser::parseUnionTypeExtension() code WC 11.0.1

private function parseUnionTypeExtension(): UnionTypeExtensionNode
{
    $start = $this->lexer->token;
    $this->expectKeyword('extend');
    $this->expectKeyword('union');
    $name = $this->parseName();
    $directives = $this->parseDirectives(true);
    $types = $this->parseUnionMemberTypes();
    if (count($directives) === 0 && count($types) === 0) {
        throw $this->unexpected();
    }

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