Skip to content

Commit 4ec12df

Browse files
committed
pass rules to markValidated
1 parent b4865e9 commit 4ec12df

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Validator/DocumentValidator.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,21 @@ public static function validate(
103103
?ValidationCache $cache = null
104104
): array {
105105
if (isset($cache)) {
106-
$cached = $cache->isValidated($schema, $ast, $rules);
107-
if ($cached) {
106+
if ($cache->isValidated($schema, $ast, $rules)) {
108107
return [];
109108
}
110109
}
111110

112-
$rules ??= static::allRules();
113-
if ($rules === []) {
111+
$finalRules = $rules ?? static::allRules();
112+
if ($finalRules === []) {
114113
return [];
115114
}
116115

117116
$typeInfo ??= new TypeInfo($schema);
118117
$context = new QueryValidationContext($schema, $ast, $typeInfo);
119118

120119
$visitors = [];
121-
foreach ($rules as $rule) {
120+
foreach ($finalRules as $rule) {
122121
$visitors[] = $rule->getVisitor($context);
123122
}
124123

@@ -133,7 +132,7 @@ public static function validate(
133132
$errors = $context->getErrors();
134133

135134
if (isset($cache) && $errors === []) {
136-
$cache->markValidated($schema, $ast);
135+
$cache->markValidated($schema, $ast, $rules);
137136
}
138137

139138
return $errors;

0 commit comments

Comments
 (0)