Automattic\WooCommerce\Vendor\GraphQL\Validator\Rules
FieldsOnCorrectType::getSuggestedFieldNames
For the field name provided, determine if there are any similar field names that may be the result of a typo.
Method of the class: FieldsOnCorrectType{}
No Hooks.
Returns
Array
Usage
// protected - for code of main (parent) or child class $result = $this->getSuggestedFieldNames( $type, $fieldName ): array;
- $type(Type) (required)
- .
- $fieldName(string) (required)
- .
FieldsOnCorrectType::getSuggestedFieldNames() FieldsOnCorrectType::getSuggestedFieldNames code WC 10.9.1
protected function getSuggestedFieldNames(Type $type, string $fieldName): array
{
if ($type instanceof HasFieldsType) {
return Utils::suggestionList(
$fieldName,
$type->getFieldNames()
);
}
// Otherwise, must be a Union type, which does not define fields.
return [];
}