[PSR-12] Multiline control structures conditions

164 views
Skip to first unread message

julien...@gmail.com

unread,
Mar 9, 2017, 10:25:35 AM3/9/17
to PHP Framework Interoperability Group
Hi.

In PSR-12, spaces are forbidden after the opening parenthesis of a control structure and before the closing one.
Does this rule apply to any spacing character, including newline?

Alexander Makarov

unread,
Mar 10, 2017, 9:03:40 AM3/10/17
to PHP Framework Interoperability Group
No, not really. I guess you mean the case with long conditions you want to split into multiple lines, right?

julien...@gmail.com

unread,
Mar 10, 2017, 9:52:58 AM3/10/17
to PHP Framework Interoperability Group
Exactly.

PSR-2 and PSR-12 do not explicitly allow such case.
IMO the current rules are subject to interpretation: one could think newlines are forbidden as well.
I even saw some coding style tools report those as invalid.

Do you think we should update the document to remove any ambiguity?

Alexander Makarov

unread,
Mar 13, 2017, 3:09:01 PM3/13/17
to PHP Framework Interoperability Group
Yes, why not? Could you pull request with the changes you think are appropriate?

julien...@gmail.com

unread,
Mar 14, 2017, 3:16:11 AM3/14/17
to PHP Framework Interoperability Group
Sure.
Reply all
Reply to author
Forward
0 new messages