forked from ramsey/uuid-doctrine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpcs.xml.dist
189 lines (146 loc) · 6.78 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/3.5.0/phpcs.xsd"
name="ramsey/uuid">
<description>ramsey/uuid coding standard</description>
<!--
Much of this coding standard is borrowed from chiron/coding-standard:
https://github.com/ncou/coding-standard
-->
<!-- Source and tests must follow the coding standard. -->
<file>./src</file>
<file>./tests</file>
<!-- Arguments for the command line runner. -->
<arg name="colors"/>
<arg value="sp"/>
<!-- Rules -->
<rule ref="PSR12">
<!-- Already checked with the sniff Squiz.WhiteSpace.SemicolonSpacing.Incorrect -->
<exclude name="PSR12.Files.DeclareStatement.SpaceFoundBeforeSemicolon"/>
</rule>
<!-- Warn about TODOs and FIXMEs in code. -->
<rule ref="Generic.Commenting.Fixme"/>
<rule ref="Generic.Commenting.Todo"/>
<!-- Constants must be all uppercase. -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<!-- Disallow 'else if' in favor of 'elseif' (increase PSR12 severity level from warning to error) -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
<type>error</type>
</rule>
<!-- Forbid comments starting with # -->
<rule ref="PEAR.Commenting.InlineComment"/>
<!-- Force array element indentation with one tab stop -->
<rule ref="Generic.Arrays.ArrayIndent"/>
<!-- Forbid 'array(...)' -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Forbid empty statements -->
<rule ref="Generic.CodeAnalysis.EmptyStatement">
<!-- But allow empty catch -->
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
</rule>
<!-- Forbid final methods in final classes -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<!-- Force whitespace after a type cast -->
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<!-- Forbid PHP 4 constructors -->
<rule ref="Generic.NamingConventions.ConstructorName"/>
<!-- Forbid any content before opening tag -->
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<!-- Forbid backtick operator -->
<rule ref="Generic.PHP.BacktickOperator"/>
<!-- Forbid 'php_sapi_name()' function, use PHP_SAPI -->
<rule ref="Generic.PHP.SAPIUsage"/>
<!-- Forbid deprecated functions -->
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<!-- Forbid a bunch of functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<!-- Forbid 'empty()'; use more strict comparison instead -->
<element key="empty" value="null"/>
<!-- Forbid some alias functions for scalars -->
<element key="doubleval" value="floatval"/>
<element key="is_double" value="is_float"/>
<element key="is_integer" value="is_int"/>
<element key="is_long" value="is_int"/>
<element key="is_real" value="is_float"/>
<!-- Forbid remaining debug functions in the code -->
<element key="d" value="null"/>
<element key="dd" value="null"/>
<element key="dump" value="null"/>
<element key="dump_d" value="null"/>
<element key="var_dump" value="null"/>
</property>
</properties>
</rule>
<!-- Forbid goto instruction -->
<rule ref="Generic.PHP.DiscourageGoto"/>
<!-- Forbid merge conflict artifacts left in files -->
<rule ref="Generic.VersionControl.GitMergeConflict"/>
<!-- Forbid spaces around square brackets -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<!-- Forbid class being in a file with different name -->
<rule ref="Squiz.Classes.ClassFileName"/>
<!-- Force 'self::' for self-reference, force lower-case self, forbid spaces around '::' -->
<rule ref="Squiz.Classes.SelfMemberReference"/>
<!-- Forbid 'AND' and 'OR', require '&&' and '||' -->
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
<!-- Forbid global functions -->
<rule ref="Squiz.Functions.GlobalFunction"/>
<!-- Forbid 'global' -->
<rule ref="Squiz.PHP.GlobalKeyword"/>
<!-- Forbid functions inside functions -->
<rule ref="Squiz.PHP.InnerFunctions"/>
<!-- Require PHP function calls in lowercase -->
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<!-- Forbid dead code -->
<rule ref="Squiz.PHP.NonExecutableCode"/>
<!-- Forbid `$this` inside static function -->
<rule ref="Squiz.Scope.StaticThisUsage"/>
<!-- Force whitespace before and after concatenation -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Forbid blank line after function opening brace -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!-- Require 1 line before and after function, except at the top and bottom -->
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
<property name="spacingBeforeFirst" value="0"/>
<property name="spacingAfterLast" value="0"/>
</properties>
</rule>
<!-- Require space after language constructs -->
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<!-- Require space around logical operators -->
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
<!-- Forbid spaces around '->' operator -->
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Forbid spaces before semicolon ';' -->
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<!-- Forbid superfluous whitespaces -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<!-- turned on by PSR12 -> turning back off -->
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<!-- turned off by PSR12 -> turning back on -->
<severity>5</severity>
</rule>
<!-- Does not allow double quotes for plain strings but does allow them if they contain a variable. -->
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
<!-- Force camelCase variables -->
<rule ref="Squiz.NamingConventions.ValidVariableName">
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
</rule>
</ruleset>