Automattic\WooCommerce\Vendor\GraphQL\Utils
TypeInfo::getFieldDefinition
Not exactly the same as the executor's definition of getFieldDef, in this statically evaluated environment we do not always have an Object type, and need to handle Interface and Union types.
Method of the class: TypeInfo{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = TypeInfo::getFieldDefinition( $schema, $parentType, $fieldNode ): ?FieldDefinition;
TypeInfo::getFieldDefinition() TypeInfo::getFieldDefinition code WC 10.9.1
private static function getFieldDefinition(Schema $schema, Type $parentType, FieldNode $fieldNode): ?FieldDefinition
{
$name = $fieldNode->name->value;
$schemaMeta = Introspection::schemaMetaFieldDef();
if ($name === $schemaMeta->name && $schema->getQueryType() === $parentType) {
return $schemaMeta;
}
$typeMeta = Introspection::typeMetaFieldDef();
if ($name === $typeMeta->name && $schema->getQueryType() === $parentType) {
return $typeMeta;
}
$typeNameMeta = Introspection::typeNameMetaFieldDef();
if ($name === $typeNameMeta->name && $parentType instanceof CompositeType) {
return $typeNameMeta;
}
if (
$parentType instanceof ObjectType
|| $parentType instanceof InterfaceType
) {
return $parentType->findField($name);
}
return null;
}