Automattic\WooCommerce\Vendor\GraphQL\Utils
TypeComparators::isEqualType
Provided two types, return true if the types are equal (invariant).
Method of the class: TypeComparators{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = TypeComparators::isEqualType( $typeA, $typeB ): bool;
TypeComparators::isEqualType() TypeComparators::isEqualType code WC 10.9.1
public static function isEqualType(Type $typeA, Type $typeB): bool
{
// Equivalent types are equal.
if ($typeA === $typeB) {
return true;
}
if (self::areSameBuiltInScalar($typeA, $typeB)) {
return true;
}
// If either type is non-null, the other must also be non-null.
if ($typeA instanceof NonNull && $typeB instanceof NonNull) {
return self::isEqualType($typeA->getWrappedType(), $typeB->getWrappedType());
}
// If either type is a list, the other must also be a list.
if ($typeA instanceof ListOfType && $typeB instanceof ListOfType) {
return self::isEqualType($typeA->getWrappedType(), $typeB->getWrappedType());
}
// Otherwise the types are not equal.
return false;
}