1
+ <?xml version =" 1.0" ?>
2
+ <ruleset name =" PHP_CodeSniffer" >
3
+ <description >The coding standard for PHP_CodeSniffer itself.</description >
4
+
5
+ <file >autoload.php</file >
6
+ <file >bin</file >
7
+ <file >scripts</file >
8
+ <file >src</file >
9
+ <file >tests</file >
10
+
11
+ <exclude-pattern >*/Standards/*/Tests/*\.(inc|css|js)</exclude-pattern >
12
+
13
+ <arg name =" basepath" value =" ." />
14
+ <arg name =" colors" />
15
+ <arg name =" parallel" value =" 75" />
16
+ <arg value =" np" />
17
+
18
+ <!-- Don't hide tokenizer exceptions -->
19
+ <rule ref =" Internal.Tokenizer.Exception" >
20
+ <type >error</type >
21
+ </rule >
22
+
23
+ <!-- Include the whole PEAR standard -->
24
+ <rule ref =" PEAR" >
25
+ <!-- <exclude name="PEAR.NamingConventions.ValidFunctionName" /> -->
26
+ <!-- <exclude name="PEAR.NamingConventions.ValidVariableName" /> -->
27
+ <exclude name =" PEAR.Commenting.ClassComment" />
28
+ <exclude name =" PEAR.Commenting.FileComment.MissingCategoryTag" />
29
+ <exclude name =" PEAR.Commenting.FileComment.MissingPackageTag" />
30
+ <exclude name =" PEAR.Commenting.FileComment.MissingLinkTag" />
31
+ <exclude name =" PEAR.Commenting.FileComment.MissingVersion" />
32
+ <exclude name =" PEAR.Commenting.InlineComment" />
33
+ </rule >
34
+
35
+ <!-- Include some sniffs from other standards that don't conflict with PEAR -->
36
+ <rule ref =" Squiz.Arrays.ArrayBracketSpacing" />
37
+ <rule ref =" Squiz.Arrays.ArrayDeclaration" />
38
+ <rule ref =" Squiz.Commenting.ClosingDeclarationComment" />
39
+ <rule ref =" Squiz.ControlStructures.ControlSignature" />
40
+ <rule ref =" Squiz.ControlStructures.ElseIfDeclaration" />
41
+ <rule ref =" Squiz.Commenting.BlockComment" />
42
+ <rule ref =" Squiz.Commenting.DocCommentAlignment" />
43
+ <rule ref =" Squiz.Commenting.EmptyCatchComment" />
44
+ <rule ref =" Squiz.Commenting.InlineComment" />
45
+ <rule ref =" Squiz.Commenting.LongConditionClosingComment" />
46
+ <rule ref =" Squiz.Commenting.PostStatementComment" />
47
+ <rule ref =" Squiz.Commenting.VariableComment" />
48
+ <rule ref =" Squiz.Formatting.OperatorBracket" />
49
+ <rule ref =" Squiz.Functions.FunctionDeclarationArgumentSpacing" />
50
+ <rule ref =" Squiz.Operators.ComparisonOperatorUsage" />
51
+ <rule ref =" Squiz.PHP.DisallowInlineIf" />
52
+ <rule ref =" Squiz.Scope.MethodScope" />
53
+ <rule ref =" Squiz.Strings.ConcatenationSpacing" />
54
+ <rule ref =" Squiz.WhiteSpace.ControlStructureSpacing" />
55
+ <rule ref =" Squiz.WhiteSpace.FunctionClosingBraceSpace" />
56
+ <rule ref =" Squiz.WhiteSpace.FunctionSpacing" />
57
+ <rule ref =" Squiz.WhiteSpace.OperatorSpacing" />
58
+ <rule ref =" Squiz.WhiteSpace.SuperfluousWhitespace" />
59
+ <rule ref =" Generic.Arrays.DisallowLongArraySyntax" />
60
+ <rule ref =" Generic.Commenting.Todo" />
61
+ <rule ref =" Generic.ControlStructures.InlineControlStructure" />
62
+ <rule ref =" Generic.Formatting.DisallowMultipleStatements" />
63
+ <rule ref =" Generic.Formatting.SpaceAfterCast" />
64
+ <rule ref =" Generic.NamingConventions.ConstructorName" />
65
+ <rule ref =" Generic.PHP.DeprecatedFunctions" />
66
+ <rule ref =" Generic.PHP.LowerCaseKeyword" />
67
+ <rule ref =" Generic.Strings.UnnecessaryStringConcat" />
68
+ <rule ref =" PSR2.Classes.PropertyDeclaration" />
69
+ <rule ref =" PSR2.Methods.MethodDeclaration" />
70
+ <rule ref =" PSR2.Files.EndFileNewline" />
71
+ <rule ref =" Zend.Files.ClosingTag" />
72
+
73
+ <!-- PEAR uses warnings for inline control structures, so switch back to errors -->
74
+ <rule ref =" Generic.ControlStructures.InlineControlStructure" >
75
+ <properties >
76
+ <property name =" error" value =" true" />
77
+ </properties >
78
+ </rule >
79
+
80
+ <!-- We use custom indent rules for arrays -->
81
+ <rule ref =" Generic.Arrays.ArrayIndent" />
82
+ <rule ref =" Squiz.Arrays.ArrayDeclaration.KeyNotAligned" >
83
+ <severity >0</severity >
84
+ </rule >
85
+ <rule ref =" Squiz.Arrays.ArrayDeclaration.ValueNotAligned" >
86
+ <severity >0</severity >
87
+ </rule >
88
+ <rule ref =" Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned" >
89
+ <severity >0</severity >
90
+ </rule >
91
+ <rule ref =" Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine" >
92
+ <severity >0</severity >
93
+ </rule >
94
+
95
+ <!-- Check var names, but we don't want leading underscores for private vars -->
96
+ <rule ref =" Squiz.NamingConventions.ValidVariableName" />
97
+ <rule ref =" Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" >
98
+ <severity >0</severity >
99
+ </rule >
100
+
101
+ <!-- Only one argument per line in multi-line function calls -->
102
+ <rule ref =" PEAR.Functions.FunctionCallSignature" >
103
+ <properties >
104
+ <property name =" allowMultipleArguments" value =" false" />
105
+ </properties >
106
+ </rule >
107
+
108
+ <!-- Have 12 chars padding maximum and always show as errors -->
109
+ <rule ref =" Generic.Formatting.MultipleStatementAlignment" >
110
+ <properties >
111
+ <property name =" maxPadding" value =" 12" />
112
+ <property name =" error" value =" true" />
113
+ </properties >
114
+ </rule >
115
+
116
+ <!-- Ban some functions -->
117
+ <rule ref =" Generic.PHP.ForbiddenFunctions" >
118
+ <properties >
119
+ <property name =" forbiddenFunctions" type =" array" >
120
+ <element key =" sizeof" value =" count" />
121
+ <element key =" delete" value =" unset" />
122
+ <element key =" print" value =" echo" />
123
+ <element key =" is_null" value =" null" />
124
+ <element key =" create_function" value =" null" />
125
+ </property >
126
+ </properties >
127
+ </rule >
128
+
129
+ <!-- Private methods MUST not be prefixed with an underscore -->
130
+ <rule ref =" PSR2.Methods.MethodDeclaration.Underscore" >
131
+ <type >error</type >
132
+ </rule >
133
+
134
+ <!-- Private properties MUST not be prefixed with an underscore -->
135
+ <rule ref =" PSR2.Classes.PropertyDeclaration.Underscore" >
136
+ <type >error</type >
137
+ </rule >
138
+
139
+ <!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
140
+ <rule ref =" Generic.Strings.UnnecessaryStringConcat" >
141
+ <exclude-pattern >tests/bootstrap.php</exclude-pattern >
142
+ </rule >
143
+
144
+ </ruleset >
0 commit comments