Skip to content

Commit a393385

Browse files
ruudkspawnia
authored andcommitted
Early return when complexity is disabled
This allows other validation rules to depend on the `QueryComplexity` rule, and disable the query complexity completely on some condition.
1 parent b3b1e69 commit a393385

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Validator/Rules/QueryComplexity.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public function getVisitor(QueryValidationContext $context): array
7575
return;
7676
}
7777

78+
if ($this->maxQueryComplexity === self::DISABLED) {
79+
return;
80+
}
81+
7882
$complexity = $this->fieldComplexity($operationDefinition->selectionSet);
7983

8084
if ($complexity <= $this->maxQueryComplexity) {

0 commit comments

Comments
 (0)