Automattic\WooCommerce\Vendor\GraphQL\Type
SchemaValidationContext::validateInterfaces
Method of the class: SchemaValidationContext{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->validateInterfaces( $type ): void;
- $type(ObjectType|InterfaceType) (required)
- .
SchemaValidationContext::validateInterfaces() SchemaValidationContext::validateInterfaces code WC 10.9.1
private function validateInterfaces(ImplementingType $type): void
{
$ifaceTypeNames = [];
foreach ($type->getInterfaces() as $interface) {
// @phpstan-ignore-next-line The generic type says this should not happen, but a user may use it wrong nonetheless
if (! $interface instanceof InterfaceType) {
$notInterface = Utils::printSafe($interface);
$this->reportError(
"Type {$type->name} must only implement Interface types, it cannot implement {$notInterface}.",
$this->getImplementsInterfaceNode($type, $interface)
);
continue;
}
if ($type === $interface) {
$this->reportError(
"Type {$type->name} cannot implement itself because it would create a circular reference.",
$this->getImplementsInterfaceNode($type, $interface)
);
continue;
}
if (isset($ifaceTypeNames[$interface->name])) {
$this->reportError(
"Type {$type->name} can only implement {$interface->name} once.",
$this->getAllImplementsInterfaceNodes($type, $interface)
);
continue;
}
$ifaceTypeNames[$interface->name] = true;
$this->validateTypeImplementsAncestors($type, $interface);
$this->validateTypeImplementsInterface($type, $interface);
}
}