mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-03-12 15:56:06 +03:00
Return early if rules are empty to avoid visiting elements
This is tested already in testPassesValidationWithEmptyRules
This commit is contained in:
parent
b97cad0f4a
commit
dc0616edaf
@ -96,6 +96,12 @@ class DocumentValidator
|
||||
if (null === $rules) {
|
||||
$rules = static::allRules();
|
||||
}
|
||||
|
||||
if (true === is_array($rules) && 0 === count($rules)) {
|
||||
// Skip validation if there are no rules
|
||||
return [];
|
||||
}
|
||||
|
||||
$typeInfo = $typeInfo ?: new TypeInfo($schema);
|
||||
$errors = static::visitUsingRules($schema, $typeInfo, $ast, $rules);
|
||||
return $errors;
|
||||
|
Loading…
x
Reference in New Issue
Block a user