Skip to content

Instantly share code, notes, and snippets.

Embed
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">
<description>
PSR2 with changes:
* tabs instead of spaces (https://gist.github.com/gsherwood/9d22f634c57f990a7c64)
* bracers on end of line instead new line
</description>
<!-- 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"/>
</rule>
<!-- tabs -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<!-- bracers -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
</ruleset>
@Ovsyanka
Copy link
Author

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

Loading

@kirrie
Copy link

kirrie commented Mar 7, 2017

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

Loading

@mtness
Copy link

mtness commented May 15, 2017

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

Loading

@DRSDavidSoft
Copy link

DRSDavidSoft commented Feb 23, 2018

Thanks for this!

Loading

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