Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

EnumType::assertValidpublicWC 1.0

Method of the class: EnumType{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

EnumType::assertValid() code WC 10.9.4

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

    $values = $this->config['values'] ?? null; // @phpstan-ignore nullCoalesce.initializedProperty (unnecessary according to types, but can happen during runtime)
    if (! is_iterable($values) && ! is_callable($values)) {
        $notIterable = Utils::printSafe($values);
        throw new InvariantViolation("{$this->name} values must be an iterable or callable, got: {$notIterable}");
    }

    $this->getValues();
}