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