coding-standards icon indicating copy to clipboard operation
coding-standards copied to clipboard

Comments in Control structures

Open piotr-cz opened this issue 10 years ago • 0 comments

Sometimes putting a comment right inside the control structure is (IMHO) the best place:

// Perform tests
if ($foo
    // Testing phase 1
    && $foo->test1()
    // Testing phase 2
    && $foo->test2())
{
    echo 'True'
}

But code sniffer complains :unamused:

 35 | ERROR | Each line in a multi-line IF statement must begin with a boolean operator

What do you think about adjust the rule?

piotr-cz avatar Dec 23 '13 17:12 piotr-cz