Automattic\WooCommerce\Vendor\GraphQL\Type

SchemaValidationContext::validateTypeIsSingletonprivateWC 1.0

Method of the class: SchemaValidationContext{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->validateTypeIsSingleton( $type, $path ): void;
$type(Type) (required)
.
$path(string) (required)
.

SchemaValidationContext::validateTypeIsSingleton() code WC 10.9.1

private function validateTypeIsSingleton(Type $type, string $path): void
{
    $schemaConfig = $this->schema->getConfig();
    if (! isset($schemaConfig->typeLoader)) {
        return;
    }

    $namedType = Type::getNamedType($type);
    if ($namedType->isBuiltInType()) {
        return;
    }

    $name = $namedType->name;
    if ($namedType !== ($schemaConfig->typeLoader)($name)) {
        throw new InvariantViolation(static::duplicateType($this->schema, $path, $name));
    }
}