Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Skip key used in next stmt on RemoveUnusedForeachKeyRector (
#5153) * [DeadCode] Skip key used in next stmt on RemoveUnusedForeachKeyRector * [DeadCode] Skip key used in next stmt on RemoveUnusedForeachKeyRector * [ci-review] Rector Rectify * continue --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
6cb63f3
commit 6d96068
Showing
2 changed files
with
53 additions
and
14 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...e/Rector/Foreach_/RemoveUnusedForeachKeyRector/Fixture/skip_key_used_in_next_stmt.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector\Fixture; | ||
|
||
final class SkipKeyUsedInNexStmt | ||
{ | ||
function lastKey ($container, $defKey = null) { | ||
$result = $defKey; | ||
|
||
foreach ($container as $result => $value) { | ||
// next | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters