Skip to content

Commit

Permalink
[DeadCode] Fix non-null type check on RemoveUnusedNonEmptyArrayBefore…
Browse files Browse the repository at this point in the history
…ForeachRector (#430)
  • Loading branch information
samsonasik committed Jul 13, 2021
1 parent 7bb957d commit f7eeeba
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions rules/DeadCode/UselessIfCondBeforeForeachDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ public function isMatchingNotEmpty(If_ $if, Expr $foreachExpr): bool
return true;
}

return $this->isNullableParam($previousParam);
}

public function isNullableParam(Param $param): bool
{
$type = $this->nodeTypeResolver->resolve($param->var);
return $type instanceof NullableType;
return ! $previousParam->type instanceof NullableType;
}

/**
Expand Down

0 comments on commit f7eeeba

Please sign in to comment.