mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56:05 +03:00
Return early if rules are empty to avoid visiting elements
This is tested already in testPassesValidationWithEmptyRules
This commit is contained in:
parent
568cae584b
commit
b3791378fa
@ -86,6 +86,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…
Reference in New Issue
Block a user