Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PSR2 with tabs instead of spaces and bracers on the end of lines
<?xml version="1.0"?>
<ruleset name="MyStandard">
PSR2 with changes:
* tabs instead of spaces (
* bracers on end of line instead new line
<!-- tabs -->
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<!-- bracers -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<!-- tabs -->
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- tabs -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
<!-- bracers -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
Copy link

Ovsyanka commented Jan 29, 2017

I changed original ruleset to put open bracers of functions and classes on the end of line instead new line. I did this changes:

For functions:

  • exclude Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
  • include Generic.Functions.OpeningFunctionBraceKernighanRitchie

For classes:

  • exclude PSR2.Classes.ClassDeclaration.OpenBraceNewLine
  • include Generic.Classes.OpeningBraceSameLine

Copy link

kirrie commented Mar 7, 2017

thanks for new ruleset. it works as expected for my phpcs.

Copy link

mtness commented May 15, 2017

Thank you, this is exactly what I was looking for!

Copy link

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment