Skip to content

Commit

Permalink
phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Nov 11, 2021
1 parent 3f5471a commit 873a2ab
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion rules/Removing/NodeManipulator/ComplexNodeRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticPropertyFetch;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Property;
Expand Down Expand Up @@ -153,9 +154,22 @@ private function removeConstructorDependency(Assign $assign): void
$paramKeysToBeRemoved[] = $key;
}

$this->processRemoveParamWithKeys($params, $paramKeysToBeRemoved);
}

/**
* @param Param[] $params
* @param int[] $paramKeysToBeRemoved
*/
private function processRemoveParamWithKeys(array $params, array $paramKeysToBeRemoved): void
{
foreach ($paramKeysToBeRemoved as $paramKeyToBeRemoved) {
$nextKeyParamToBeRemoved = $paramKeyToBeRemoved + 1;
if (isset($params[$nextKeyParamToBeRemoved]) && ! in_array($nextKeyParamToBeRemoved, $paramKeysToBeRemoved, true)) {
if (isset($params[$nextKeyParamToBeRemoved]) && ! in_array(
$nextKeyParamToBeRemoved,
$paramKeysToBeRemoved,
true
)) {
break;
}

Expand Down

0 comments on commit 873a2ab

Please sign in to comment.