-
Notifications
You must be signed in to change notification settings - Fork 23
/
phpcs.xml
86 lines (76 loc) · 3.25 KB
/
phpcs.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0"?>
<ruleset name="App">
<!-- Paths that have not been autocorrected yet -->
<exclude-pattern>plugins/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<exclude-pattern>vendors/</exclude-pattern>
<exclude-pattern>webroot/</exclude-pattern>
<rule ref="PSR12" />
<arg name="extensions" value="php,ctp" />
<!-- enforce two spaces for indentation (all other company projects use this, and we have been using it for the crm so far too, so this avoids a diff on all lines rolling this out -->
<arg name="tab-width" value="2"/>
<!--
Relax line length rules. This is a low value rule
that doesn't require strict enforcement for now.
-->
<rule ref="Generic.Files.LineLength.TooLong">
<severity>0</severity>
</rule>
<!-- enforce short array syntax (we were already manually migrating to this as we touched files ourselves, so this is actually very nice to have automated now) -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax">
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2" />
<property name="exact" value="true" />
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<rule ref="Generic.Arrays.ArrayIndent">
<properties>
<property name="indent" value="2" />
</properties>
</rule>
<rule ref="PSR1">
<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" />
</rule>
<!-- enforce opening curly brace on the same line (for team familiarity, smaller diff migrating to phpcs) -->
<rule ref="PSR2">
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
</rule>
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
<!-- enforce consistent indentation of multi line method arrow chaining -->
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent">
<properties>
<property name="indent" value="2" />
<property name="multilevel" value="false" />
</properties>
</rule>
<!-- enforce that function arguments are indented with 2 spaces -->
<rule ref="PSR2.Methods.FunctionCallSignature">
<properties>
<property name="indent" value="2" />
</properties>
</rule>
<!-- allow underscores to hint visibility, to reduce diff and help autofixing efforts -->
<rule ref="PSR2">
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
</rule>
<!-- Relax some src/* and tests/* rules -->
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>*/config/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/src/Command/*</exclude-pattern>
</rule>
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
</ruleset>