Automattic\WooCommerce\Vendor\GraphQL\Type
Introspection::_field
Method of the class: Introspection{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = Introspection::_field(): ObjectType;
Introspection::_field() Introspection:: field code WC 10.9.1
public static function _field(): ObjectType
{
return self::$cachedInstances[self::FIELD_OBJECT_NAME] ??= new ObjectType([ // @phpstan-ignore missingType.checkedException (static configuration is known to be correct)
'name' => self::FIELD_OBJECT_NAME,
'isIntrospection' => true,
'description' => 'Object and Interface types are described by a list of Fields, each of '
. 'which has a name, potentially a list of arguments, and a return type.',
'fields' => static fn (): array => [
'name' => [
'type' => Type::nonNull(Type::string()),
'resolve' => static fn (FieldDefinition $field): string => $field->name,
],
'description' => [
'type' => Type::string(),
'resolve' => static fn (FieldDefinition $field): ?string => $field->description,
],
'args' => [
'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
'args' => [
'includeDeprecated' => [
'type' => Type::nonNull(Type::boolean()),
'defaultValue' => false,
],
],
'resolve' => static function (FieldDefinition $field, $args): array {
$values = $field->args;
if (! $args['includeDeprecated']) {
return array_filter(
$values,
static fn (Argument $value): bool => ! $value->isDeprecated(),
);
}
return $values;
},
],
'type' => [
'type' => Type::nonNull(self::_type()),
'resolve' => static fn (FieldDefinition $field): Type => $field->getType(),
],
'isDeprecated' => [
'type' => Type::nonNull(Type::boolean()),
'resolve' => static fn (FieldDefinition $field): bool => $field->isDeprecated(),
],
'deprecationReason' => [
'type' => Type::string(),
'resolve' => static fn (FieldDefinition $field): ?string => $field->deprecationReason,
],
],
]);
}