Putting multiple statements on a single line lowers the code readability and makes debugging the code more complex.
if (someCondition) { doSomething(); } // Noncompliant
doSomething(); doSomethingElse(); // Noncompliant
Write one statement per line to improve readability.
if (someCondition) {
doSomething();
}
doSomething();
doSomethingElse();
The rule ignores anonymous functions containing a single statement.
$max_comparator = function ($v) { return $v > 2; }; // Compliant by exception
$max_comparator = function ($v) { echo $v; return $v > 2; }; // Noncompliant