Skip to content

Files

Latest commit

 

History

History
26 lines (19 loc) · 561 Bytes

Generic.CodeAnalysis.ForLoopWithTestFunctionCall.md

File metadata and controls

26 lines (19 loc) · 561 Bytes

Pattern: for with test function call

Issue: -

Description

Detects for loops that use a function call in the test expression.

Example

class Foo
{
    public function bar($x)
    {
        $a = array(1, 2, 3, 4);
        for ($i = 0; $i < count($a); $i++) {
             $a[$i] *= $i;
        }
    }
}

Further Reading