-
Notifications
You must be signed in to change notification settings - Fork 13
/
phpcs.xml.dist
195 lines (172 loc) · 7.3 KB
/
phpcs.xml.dist
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?xml version="1.0"?>
<ruleset name="Coding standard for harvest-api-php-client">
<!-- Check all PHP files in directory tree by default. -->
<arg name="extensions" value="php"/>
<file>.</file>
<!-- Show progress and sniff codes in all reports. -->
<arg value="ps"/>
<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache"/>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="PSR2.Methods.FunctionCallSignature"/>
<exclude name="PSR2.ControlStructures.ControlStructureSpacing"/>
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<!-- Allow opening and closing braces for functions and classes to be on the same line. -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/>
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace"/>
</rule>
<!-- Tabs, no spaces. -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<!-- Class/function opening braces should be on the same line as the statement. -->
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
<properties>
<property name="checkClosures" value="true"/>
</properties>
</rule>
<!-- Spacing for function calls. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
<property name="requiredSpacesAfterOpen" value="1"/>
<property name="requiredSpacesBeforeClose" value="1"/>
</properties>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="requiredSpacesAfterOpen" value="1"/>
<property name="requiredSpacesBeforeClose" value="1"/>
</properties>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity phpcs-only="true">0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity phpcs-only="true">0</severity>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<!-- Increase line length a bit. -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="200"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<!-- Disallows grouped use declarations. -->
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/>
<!-- Disallows leading backslash in use statement. -->
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<!-- Enforces fully qualified names of classes and interfaces in annotations. -->
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
<!-- Checks whether uses at the top of a file are alphabetically sorted. -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
<!-- Enforces one space after namespace, disallows content between namespace name and semicolon and disallows use of bracketed syntax. -->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration"/>
<!-- Prohibits multiple uses separated by commas. -->
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
<!-- Enforces one blank line before and after namespace. -->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing">
<properties>
<property name="linesCountBeforeNamespace" value="1"/>
<property name="linesCountAfterNamespace" value="1"/>
</properties>
</rule>
<!-- Enforces one blank before first use, after last use and none between two different types of use. -->
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
<properties>
<property name="linesCountBeforeFirstUse" value="1"/>
<property name="linesCountBetweenUseTypes" value="0"/>
<property name="linesCountAfterLastUse" value="1"/>
</properties>
</rule>
<!-- Prohibits uses from the same namespace. -->
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<!-- All references to types named Exception or ending with Exception must be referenced via a fully qualified name. -->
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
<!-- Looks for unused imports from other namespaces. -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
<!-- Require root namespace for special compiled PHP functions. -->
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions">
<properties>
<property name="includeSpecialFunctions" value="true"/>
</properties>
</rule>
<!-- Checks that there's no whitespace between a nullability symbol and a typehint. -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<!-- Checks whether the nullablity ? symbol is present before each nullable and optional parameter. -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<!-- Enforce no space between closing brace and colon of return typehint. -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
<properties>
<property name="spacesCountBeforeColon" value="0"/>
</properties>
</rule>
<!-- Enforces using shorthand scalar typehint variants in phpDocs. -->
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<!-- Class names should be referenced via ::class constant when possible. -->
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<!-- Requires use of null coalesce operator (??) when possible. -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
<!-- Reports forbidden annotations. -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@package"/>
<element value="@author"/>
<element value="@created"/>
<element value="@copyright"/>
<element value="@license"/>
<element value="@access"/>
<element value="@version"/>
</property>
</properties>
</rule>
<!-- Require specific order of PHPDoc annotations with empty newline between specific groups. -->
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="linesCountBeforeFirstContent" value="0"/>
<property name="linesCountAfterLastContent" value="0"/>
<property name="linesCountBetweenDescriptionAndAnnotations" value="1"/>
<property name="linesCountBetweenAnnotationsGroups" value="1"/>
<property name="annotationsGroups" type="array">
<element value="@internal"/>
<element value="
@since,
@deprecated,
"/>
<element value="
@link,
@see,
@uses,
"/>
<element value="
@global,
"/>
<element value="
@throws,
"/>
<element value="
@param,
@type,
@return,
"/>
</property>
</properties>
</rule>
<!-- Checks for PHP cross-version compatibility. -->
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="7.2-"/>
<!-- Directories and third party library exclusions. -->
<exclude-pattern>/vendor/*</exclude-pattern>
</ruleset>