Created
December 5, 2014 20:06
-
-
Save gsherwood/9d22f634c57f990a7c64 to your computer and use it in GitHub Desktop.
PSR2 with tabs instead of spaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="MyStandard"> | |
<description>PSR2 with tabs instead of spaces.</description> | |
<arg name="tab-width" value="4"/> | |
<rule ref="PSR2"> | |
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/> | |
</rule> | |
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/> | |
<rule ref="Generic.WhiteSpace.ScopeIndent"> | |
<properties> | |
<property name="indent" value="4"/> | |
<property name="tabIndent" value="true"/> | |
</properties> | |
</rule> | |
</ruleset> |
I’m having trouble with these rules and the following lines:
if(condition)
foreach(blah){
}
getting an error
358 | ERROR | [x] Line indented incorrectly; expected 3 tabs, found
| | 4
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
Looks like the lack of brackets in the conditional doesn’t increment the expected indentation level. Is that a bug?
Richard Hendricks would be proud :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes. I did this in my fork. There is the explanation:
For functions you should
Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
Generic.Functions.OpeningFunctionBraceKernighanRitchie
For classes you should
PSR2.Classes.ClassDeclaration.OpenBraceNewLine
Generic.Classes.OpeningBraceSameLine