Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

UnionType::assertValidpublicWC 1.0

Method of the class: UnionType{}

No Hooks.

Returns

null. Nothing (null).

Usage

$UnionType = new UnionType();
$UnionType->assertValid(): void;

UnionType::assertValid() code WC 10.9.1

public function assertValid(): void
{
    Utils::assertValidName($this->name);

    $resolveType = $this->config['resolveType'] ?? null;
    // @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
    if (isset($resolveType) && ! is_callable($resolveType)) {
        $notCallable = Utils::printSafe($resolveType);
        throw new InvariantViolation("{$this->name} must provide \"resolveType\" as null or a callable, but got: {$notCallable}.");
    }
}