Automattic\WooCommerce\Vendor\GraphQL\Validator\Rules

PossibleTypeExtensions::typeToExtKindprivate staticWC 1.0

Method of the class: PossibleTypeExtensions{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = PossibleTypeExtensions::typeToExtKind( $type ): string;
$type(NamedType) (required)
.

PossibleTypeExtensions::typeToExtKind() code WC 10.9.1

private static function typeToExtKind(NamedType $type): string
{
    switch (true) {
        case $type instanceof ScalarType:
            return NodeKind::SCALAR_TYPE_EXTENSION;
        case $type instanceof ObjectType:
            return NodeKind::OBJECT_TYPE_EXTENSION;
        case $type instanceof InterfaceType:
            return NodeKind::INTERFACE_TYPE_EXTENSION;
        case $type instanceof UnionType:
            return NodeKind::UNION_TYPE_EXTENSION;
        case $type instanceof EnumType:
            return NodeKind::ENUM_TYPE_EXTENSION;
        case $type instanceof InputObjectType:
            return NodeKind::INPUT_OBJECT_TYPE_EXTENSION;
        default:
            $unexpectedType = Utils::printSafe($type);
            throw new InvariantViolation("Unexpected type: {$unexpectedType}.");
    }
}