Automattic\WooCommerce\Vendor\GraphQL\Type

Introspection::_enumValuepublic staticWC 1.0

Method of the class: Introspection{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = Introspection::_enumValue(): ObjectType;

Introspection::_enumValue() code WC 10.9.1

public static function _enumValue(): ObjectType
{
    return self::$cachedInstances[self::ENUM_VALUE_OBJECT_NAME] ??= new ObjectType([ // @phpstan-ignore missingType.checkedException (static configuration is known to be correct)
        'name' => self::ENUM_VALUE_OBJECT_NAME,
        'isIntrospection' => true,
        'description' => 'One possible value for a given Enum. Enum values are unique values, not '
                . 'a placeholder for a string or numeric value. However an Enum value is '
                . 'returned in a JSON response as a string.',
        'fields' => [
            'name' => [
                'type' => Type::nonNull(Type::string()),
                'resolve' => static fn (EnumValueDefinition $enumValue): string => $enumValue->name,
            ],
            'description' => [
                'type' => Type::string(),
                'resolve' => static fn (EnumValueDefinition $enumValue): ?string => $enumValue->description,
            ],
            'isDeprecated' => [
                'type' => Type::nonNull(Type::boolean()),
                'resolve' => static fn (EnumValueDefinition $enumValue): bool => $enumValue->isDeprecated(),
            ],
            'deprecationReason' => [
                'type' => Type::string(),
                'resolve' => static fn (EnumValueDefinition $enumValue): ?string => $enumValue->deprecationReason,
            ],
        ],
    ]);
}