How can I modify PSR2 to check that all opening braces are on the new line everywhere


April 2019


3 time


I've spent a lot of time to figure out how to require the { always on the new line (including inside functions). We have several projects with altered coding standards and I would like to write phpcs-ruleset.xml, so phpcs could check this standard.

I know how to write phpcs-ruleset.xml based on PSR2 with excludes. I know how to disable the check { at the end of the same line, but it hasn't solved my problem.
I tried to generate a new ruleset here: but it didn't help.
I tried to find some inspiration here: phpcs: How can I modify PSR2 to check that the brace is on the same line as the method? but it didn't help either.

I couldn't find a rule, which can be used for checking { on the new line, or how to write the ruleset. Any help would be appreciated.

0 answers