Skip to content

Commit d657e3b

Browse files
phpstan-botclaude
andcommitted
Move args count check before expensive phpVersion/reflectionProvider checks in FilterVarRule
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b4f3ef5 commit d657e3b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Rules/Functions/FilterVarRule.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ public function processNode(Node $node, Scope $scope): array
4646

4747
$args = $node->getArgs();
4848

49+
if (count($args) < 3) {
50+
return [];
51+
}
52+
4953
if (
5054
!$this->phpVersion->hasFilterThrowOnFailureConstant()
5155
|| !$this->reflectionProvider->hasConstant(new Name\FullyQualified('FILTER_THROW_ON_FAILURE'), null)
5256
) {
5357
return [];
5458
}
5559

56-
if (count($args) < 3) {
57-
return [];
58-
}
59-
6060
$flagsType = $scope->getType($args[2]->value);
6161

6262
if ($this->filterFunctionReturnTypeHelper->hasFlag('FILTER_NULL_ON_FAILURE', $flagsType)

0 commit comments

Comments
 (0)