Automattic\WooCommerce\Vendor\GraphQL\Type
SchemaValidationContext::validateTypeImplementsAncestors
Method of the class: SchemaValidationContext{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->validateTypeImplementsAncestors( $type, $iface ): void;
- $type(ObjectType|InterfaceType) (required)
- .
- $iface(InterfaceType) (required)
- .
SchemaValidationContext::validateTypeImplementsAncestors() SchemaValidationContext::validateTypeImplementsAncestors code WC 10.9.1
private function validateTypeImplementsAncestors(ImplementingType $type, InterfaceType $iface): void
{
$typeInterfaces = $type->getInterfaces();
foreach ($iface->getInterfaces() as $transitive) {
if (! in_array($transitive, $typeInterfaces, true)) {
$this->reportError(
$transitive === $type
? "Type {$type->name} cannot implement {$iface->name} because it would create a circular reference."
: "Type {$type->name} must implement {$transitive->name} because it is implemented by {$iface->name}.",
array_merge(
$this->getAllImplementsInterfaceNodes($iface, $transitive),
$this->getAllImplementsInterfaceNodes($type, $iface)
)
);
}
}
}