Add PHPCS configuration for SilverStripe 3.x

Based on PSR-2, allowing some exceptions like class and method naming rules and namespaces for every class
This commit is contained in:
Robbie Averill 2017-04-28 07:28:35 +12:00
parent f299c4d18d
commit 451e7961d2
1 changed files with 25 additions and 0 deletions

25
phpcs.xml.dist Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<ruleset name="SS3">
<description>Coding standard for SilverStripe 3.x</description>
<!-- Don't sniff third party libraries -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/thirdparty/*</exclude-pattern>
<exclude-pattern type="relative">^index.php</exclude-pattern>
<!-- Show progress and output sniff names on violation, and add colours -->
<arg value="sp"/>
<arg name="colors"/>
<!-- Use PSR-2 as a base standard -->
<rule ref="PSR2">
<!-- Allow classes to not declare a namespace -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
<!-- Allow underscores in class names -->
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
<!-- Allow non camel cased method names -->
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
</rule>
</ruleset>