mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-04-02 20:26:09 +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
1 changed files with 6 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue