Skip to content

Commit 2d64686

Browse files
staabmondrejmirtes
authored andcommitted
10% faster FunctionCallParametersCheck
1 parent edc13ad commit 2d64686

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/Rules/FunctionCallParametersCheck.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ public function check(
8888
$hasNamedArguments = false;
8989
$hasUnpackedArgument = false;
9090
$errors = [];
91-
foreach ($args as $i => $arg) {
92-
$type = $scope->getType($arg->value);
91+
foreach ($args as $arg) {
9392
if ($hasNamedArguments && $arg->unpack) {
9493
$errors[] = RuleErrorBuilder::message('Named argument cannot be followed by an unpacked (...) argument.')
9594
->identifier('argument.unpackAfterNamed')
@@ -113,6 +112,7 @@ public function check(
113112
$argumentName = $arg->name->toString();
114113
}
115114
if ($arg->unpack) {
115+
$type = $scope->getType($arg->value);
116116
$arrays = $type->getConstantArrays();
117117
if (count($arrays) > 0) {
118118
$minKeys = null;
@@ -191,7 +191,7 @@ public function check(
191191

192192
if (!$hasNamedArguments) {
193193
$invokedParametersCount = count($arguments);
194-
foreach ($arguments as $i => [$argumentValue, $argumentValueType, $unpack, $argumentName]) {
194+
foreach ($arguments as [$argumentValue, $argumentValueType, $unpack, $argumentName]) {
195195
if ($unpack) {
196196
$invokedParametersCount = max($functionParametersMinCount, $functionParametersMaxCount);
197197
break;

0 commit comments

Comments
 (0)