Skip to content

Instantly share code, notes, and snippets.

@sirbrillig
Forked from Ovsyanka/ruleset.xml
Last active September 26, 2024 06:22
Show Gist options
  • Save sirbrillig/5adeeff47275db8a6af1d36de0a7af29 to your computer and use it in GitHub Desktop.
Save sirbrillig/5adeeff47275db8a6af1d36de0a7af29 to your computer and use it in GitHub Desktop.
PHPCS rules for PSR2 with tabs, same-line braces, and missing variable detection
<?xml version="1.0"?>
<ruleset name="PaytonsStandard">
<description>
Originally from https://gist.github.com/Ovsyanka/e2ab2ff76e7c0d7e75a1e4213a03ff95
PSR2 with changes:
- tabs instead of spaces (https://gist.github.com/gsherwood/9d22f634c57f990a7c64)
- bracers on end of line instead new line
- unused/undefined variable detection (https://github.com/sirbrillig/phpcs-variable-analysis)
</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<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>
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis"/>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment