Pattern: Use of for
instead of while
loop
Issue: -
Detects for
loops that can be simplified as a while
loop.
Example of incorrect code:
// no Init or Update part
for (;$test;) {
$test = doSomething();
}
Example of correct code:
for ($i = 0; $i < 10; $i++) {
echo "{$i}\n";
}