Skip to content

Commit 82c72cc

Browse files
staabmclxmstaab
andauthored
SyntaxErrorRules: early-return when required arguments are missing (#120)
Co-authored-by: Markus Staab <[email protected]>
1 parent b074690 commit 82c72cc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Rules/SyntaxErrorInQueryFunctionRule.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public function processNode(Node $node, Scope $scope): array
7272

7373
$args = $node->getArgs();
7474

75+
if (!\array_key_exists($queryArgPosition, $args)) {
76+
return [];
77+
}
78+
7579
$queryReflection = new QueryReflection();
7680
$queryString = $queryReflection->resolveQueryString($args[$queryArgPosition]->value, $scope);
7781
if (null === $queryString) {

src/Rules/SyntaxErrorInQueryMethodRule.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ public function processNode(Node $node, Scope $scope): array
6464

6565
$args = $node->getArgs();
6666

67+
if (!\array_key_exists($queryArgPosition, $args)) {
68+
return [];
69+
}
70+
6771
$queryReflection = new QueryReflection();
6872
$queryString = $queryReflection->resolveQueryString($args[$queryArgPosition]->value, $scope);
6973
if (null === $queryString) {

0 commit comments

Comments
 (0)