Automattic\WooCommerce\Vendor\GraphQL\Utils
BuildClientSchema::getType
Method of the class: BuildClientSchema{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->getType( $typeRef ): Type;
- $typeRef(array) (required)
- .
BuildClientSchema::getType() BuildClientSchema::getType code WC 10.9.1
private function getType(array $typeRef): Type
{
if (isset($typeRef['kind'])) {
if ($typeRef['kind'] === TypeKind::LIST) {
if (! isset($typeRef['ofType'])) {
throw new InvariantViolation('Decorated type deeper than introspection query.');
}
return new ListOfType($this->getType($typeRef['ofType']));
}
if ($typeRef['kind'] === TypeKind::NON_NULL) {
if (! isset($typeRef['ofType'])) {
throw new InvariantViolation('Decorated type deeper than introspection query.');
}
// @phpstan-ignore-next-line if the type is not a nullable type, schema validation will catch it
return new NonNull($this->getType($typeRef['ofType']));
}
}
if (! isset($typeRef['name'])) {
$unknownTypeRef = Utils::printSafeJson($typeRef);
throw new InvariantViolation("Unknown type reference: {$unknownTypeRef}.");
}
return $this->getNamedType($typeRef['name']);
}