FP php:S1808 - foreach - space before as


Consider the following PHP code:

foreach (
) {

This reports php:S1808 (Put exactly one space after and before “as” in “foreach” statement.).

I don’t understand, why this is not PSR2 conform, although it’s ok to split argument lists and
variable lists across multiple lines in case of long lines.


In the argument list, there MUST NOT be a space before each comma, and there
MUST be one space after each comma.

Argument lists MAY be split across multiple lines, where each subsequent line
is indented once.

Best regards,

Hello Steve,

Thanks for the feedback. It seems to be indeed a FP with the implementation of S1808 for PHP. The rule should allow spreading arguments on dedicated lines. I consequently created the following ticket to handle it: SONARPHP-795