1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ - https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
4
+ - https://github.com/squizlabs/PHP_CodeSniffer/tree/master/src/Standards
5
+ -->
6
+ <ruleset name =" WikimediaDeutschlandStyle" >
7
+
8
+ <file >includes/</file >
9
+ <file >tests/</file >
10
+
11
+ <rule ref =" vendor/mediawiki/mediawiki-codesniffer/MediaWiki/Sniffs/WhiteSpace" >
12
+ <exclude name =" vendor/mediawiki/mediawiki-codesniffer/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php" />
13
+ </rule >
14
+
15
+ <rule ref =" Generic.Arrays.DisallowLongArraySyntax" />
16
+ <rule ref =" Generic.Classes" />
17
+ <rule ref =" Generic.CodeAnalysis" >
18
+ <exclude name =" Generic.CodeAnalysis.EmptyStatement" />
19
+ <exclude name =" Generic.CodeAnalysis.UnusedFunctionParameter" />
20
+ </rule >
21
+ <rule ref =" Generic.ControlStructures" />
22
+
23
+ <rule ref =" Generic.Files.ByteOrderMark" />
24
+ <rule ref =" Generic.Files.LineEndings" />
25
+ <rule ref =" Generic.Files.LineLength" >
26
+ <properties >
27
+ <!-- https://github.com/squizlabs/PHP_CodeSniffer/issues/1094 -->
28
+ <property name =" lineLimit" value =" 170" />
29
+ <property name =" absoluteLineLimit" value =" 170" />
30
+ </properties >
31
+ </rule >
32
+
33
+ <rule ref =" Generic.Formatting.DisallowMultipleStatements" />
34
+
35
+ <rule ref =" Generic.Functions.CallTimePassByReference" />
36
+ <rule ref =" Generic.Functions.FunctionCallArgumentSpacing" />
37
+
38
+ <rule ref =" Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
39
+
40
+ <rule ref =" Generic.Metrics.NestingLevel" >
41
+ <properties >
42
+ <property name =" nestingLevel" value =" 3" />
43
+ <property name =" absoluteNestingLevel" value =" 3" />
44
+ </properties >
45
+ </rule >
46
+
47
+ <rule ref =" Generic.Metrics.CyclomaticComplexity" >
48
+ <properties >
49
+ <property name =" complexity" value =" 10" />
50
+ <property name =" absoluteComplexity" value =" 10" />
51
+ </properties >
52
+ </rule >
53
+
54
+ <rule ref =" Generic.NamingConventions" />
55
+ <!-- TODO: create variation of this sniff that allows underscores in test methods -->
56
+ <rule ref =" Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps" >
57
+ <!-- Exclude test methods like "testGivenInvalidInput_methodThrowsException". -->
58
+ <exclude-pattern >*Test\.php</exclude-pattern >
59
+ </rule >
60
+
61
+ <rule ref =" Generic.PHP.CharacterBeforePHPOpeningTag" />
62
+ <rule ref =" Generic.PHP.DeprecatedFunctions" />
63
+ <rule ref =" Generic.PHP.DisallowShortOpenTag" />
64
+ <rule ref =" Generic.PHP.ForbiddenFunctions" />
65
+ <rule ref =" Generic.PHP.LowerCaseConstant" />
66
+ <rule ref =" Generic.PHP.LowerCaseKeyword" />
67
+ <rule ref =" Generic.PHP.SAPIUsage" />
68
+
69
+ <rule ref =" Generic.WhiteSpace.DisallowSpaceIndent" />
70
+
71
+ <rule ref =" PSR1" />
72
+ <!-- TODO: create variation of this sniff that allows underscores in test methods -->
73
+ <rule ref =" PSR1.Methods.CamelCapsMethodName.NotCamelCaps" >
74
+ <!-- Exclude test methods like "testGivenInvalidInput_methodThrowsException". -->
75
+ <exclude-pattern >*Test\.php</exclude-pattern >
76
+ </rule >
77
+
78
+ <rule ref =" PSR2.Classes.PropertyDeclaration" />
79
+ <rule ref =" PSR2.ControlStructures.ElseIfDeclaration" />
80
+ <rule ref =" PSR2.Namespaces" />
81
+
82
+ <rule ref =" Squiz.Arrays.ArrayBracketSpacing" />
83
+ <rule ref =" Squiz.CSS.SemicolonSpacing" />
84
+ <rule ref =" Squiz.Classes.DuplicateProperty" />
85
+ <rule ref =" Squiz.Classes.SelfMemberReference" />
86
+ <rule ref =" Squiz.Classes.ValidClassName" />
87
+ <rule ref =" Squiz.Functions.FunctionDuplicateArgument" />
88
+ <rule ref =" Squiz.Functions.GlobalFunction" />
89
+ <rule ref =" Squiz.Scope" />
90
+
91
+ <rule ref =" Squiz.Strings.DoubleQuoteUsage" />
92
+ <rule ref =" Squiz.Strings.DoubleQuoteUsage.ContainsVar" >
93
+ <severity >0</severity >
94
+ </rule >
95
+
96
+ <rule ref =" Squiz.WhiteSpace.CastSpacing" />
97
+ <rule ref =" Squiz.WhiteSpace.LanguageConstructSpacing" />
98
+ <rule ref =" Squiz.WhiteSpace.LogicalOperatorSpacing" />
99
+
100
+ <rule ref =" Squiz.WhiteSpace.OperatorSpacing" >
101
+ <properties >
102
+ <property name =" ignoreNewlines" value =" true" />
103
+ </properties >
104
+ <exclude name =" Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
105
+ <exclude name =" Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
106
+ </rule >
107
+
108
+ <rule ref =" Squiz.WhiteSpace.ScopeClosingBrace" />
109
+ <rule ref =" Squiz.WhiteSpace.ScopeKeywordSpacing" />
110
+ <rule ref =" Squiz.WhiteSpace.SemicolonSpacing" />
111
+ <rule ref =" Squiz.WhiteSpace.SuperfluousWhitespace" />
112
+ <rule ref =" Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" >
113
+ <severity >0</severity >
114
+ </rule >
115
+
116
+ <rule ref =" Zend.Files.ClosingTag" />
117
+
118
+ <!-- MediaWiki.WhiteSpace.SpaceyParenthesis replica for up-to-date codesniffer version -->
119
+ <rule ref =" Squiz.Functions.FunctionDeclarationArgumentSpacing" >
120
+ <properties >
121
+ <property name =" equalsSpacing" value =" 1" />
122
+ <property name =" requiredSpacesAfterOpen" value =" 1" />
123
+ <property name =" requiredSpacesBeforeClose" value =" 1" />
124
+ </properties >
125
+ </rule >
126
+
127
+ <rule ref =" PEAR.Functions.FunctionCallSignature" >
128
+ <properties >
129
+ <property name =" requiredSpacesAfterOpen" value =" 1" />
130
+ <property name =" requiredSpacesBeforeClose" value =" 1" />
131
+ </properties >
132
+ <exclude name =" PEAR.Functions.FunctionCallSignature.Indent" />
133
+ <exclude name =" PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
134
+ <exclude name =" PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
135
+ <exclude name =" PEAR.Functions.FunctionCallSignature.OpeningIndent" />
136
+ </rule >
137
+
138
+ <!-- Using 3rd party sniff while Squiz isn't there, yet. https://github.com/squizlabs/PHP_CodeSniffer/issues/911 -->
139
+ <rule ref =" ./vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/DeclareStrictTypesSniff.php" />
140
+ <rule ref =" SlevomatCodingStandard.TypeHints.DeclareStrictTypes" >
141
+ <properties >
142
+ <property name =" newlinesCountBetweenOpenTagAndDeclare" value =" 2" />
143
+ <property name =" spacesCountAroundEqualsSign" value =" 1" />
144
+ </properties >
145
+ </rule >
146
+
147
+ <rule ref =" ./vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/ReturnTypeHintSpacingSniff.php" />
148
+
149
+ <rule ref =" ./vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/TypeHintDeclarationSniff.php" >
150
+ <exclude name =" SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableParameterTypeHintSpecification" />
151
+ <exclude name =" SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversablePropertyTypeHintSpecification" />
152
+ <exclude name =" SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableReturnTypeHintSpecification" />
153
+ <exclude name =" SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingPropertyTypeHint" />
154
+ </rule >
155
+
156
+ <rule ref =" SlevomatCodingStandard.TypeHints.TypeHintDeclaration" >
157
+ <properties >
158
+ <property name =" usefulAnnotations" type =" array" value ="
159
+ @see,
160
+ @throws,
161
+ @dataProvider,
162
+ @slowThreshold,
163
+ @noinspection
164
+ " />
165
+ <property name =" enableVoidTypeHint" value =" false" />
166
+ </properties >
167
+ </rule >
168
+
169
+ <rule ref =" ./vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/UseDoesNotStartWithBackslashSniff.php" />
170
+
171
+ <rule ref =" MediaWiki.WhiteSpace.DisallowEmptyLineFunctions" >
172
+ <exclude name =" MediaWiki.WhiteSpace.DisallowEmptyLineFunctions.NoEmptyLine" />
173
+ <exclude name =" MediaWiki.WhiteSpace.SpaceAfterClosure.NoWhitespaceAfterClosure" />
174
+ </rule >
175
+ </ruleset >
0 commit comments