Skip to content

Commit 646bf5d

Browse files
authored
Fix merge
1 parent a4c847f commit 646bf5d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/php/PHPMD/Rule/AbstractLocalVariable.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,7 @@ protected function isPassedByReference($variable)
305305
return false;
306306
}
307307

308-
$argumentPosition = min(
309-
array_search($this->getNode($variable), $parent->getChildren()),
310-
count($parameters) - 1
311-
);
308+
$argumentPosition = array_search($this->getNode($variable), $parent->getChildren());
312309
$function = $this->getNode($parent->getParent());
313310
$functionParent = $this->getNode($function->getParent());
314311
$functionName = $function->getImage();
@@ -325,6 +322,7 @@ protected function isPassedByReference($variable)
325322
}
326323

327324
$parameters = $reflectionFunction->getParameters();
325+
$argumentPosition = min($argumentPosition, count($parameters) - 1);
328326

329327
return isset($parameters[$argumentPosition]) && $parameters[$argumentPosition]->isPassedByReference();
330328
}

0 commit comments

Comments
 (0)