I'm trying to set up a rule set for PHP CodeSniffer to provide code style among the development team, but I ran into some problems.
We would like to stick with PSR-2, except for two things. We want class declarations to have an open bracket on the same line and the same for functions. The first thing I managed to fix, but the error for the open curly brace in one line for functions just wonβt disappear.
I traced it to sniff Generic.Functions.OpeningFunctionBrace.BsdAllman and BraceOnSameLine errors, but adding this exception to my rule set does nothing.
My rule set is as follows:
<?xml version="1.0"?> <ruleset name="OrgXYZ"> <description>The coding standard for Organization XYZ.</description> <rule ref="PSR2"> <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/> <exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine"/> </rule> </ruleset>
And the message I'm trying to remove from the report is the following:
15 | ERROR | Opening brace should be on a new line
This is my first attempt to create my own set of rules, and I'm really at a loss. I searched Google, searched and tried everything that seems.
source share