-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpcs.xml.dist
155 lines (125 loc) · 5.41 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
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Charcoal">
<description>Charcoal Coding Standard</description>
<arg name="encoding" value="utf-8" />
<config name="show_progress" value="1" />
<config name="ignore_warnings_on_exit" value="1" />
<rule ref="PSR2" />
<!-- Forbid `array(...)` -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<!-- Forbid duplicate classes -->
<rule ref="Generic.Classes.DuplicateClassName" />
<!-- 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" />
<!-- Forbid useless empty method overrides -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<!-- Forbid PHP 4 constructors -->
<rule ref="Generic.NamingConventions.ConstructorName" />
<!-- Forbid any content before opening tag -->
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />
<!-- Forbid deprecated functions -->
<rule ref="Generic.PHP.DeprecatedFunctions" />
<!-- Forbid alias functions, i.e. `sizeof()`, `delete()` -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property
name="forbiddenFunctions"
type="array"
value="
chop => rtrim,
close => closedir,
delete => unset,
doubleval => floatval,
fputs => fwrite,
ini_alter => ini_set,
is_double => is_float,
is_integer => is_int,
is_long => is_int,
is_null => null,
is_real => is_float,
is_writeable => is_writable,
join => implode,
key_exists => array_key_exists,
pos => current,
settype => null,
show_source => highlight_file,
sizeof => count,
strchr => strstr
" />
</properties>
</rule>
<!-- Forbid useless inline string concatenation -->
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<!-- But multiline is useful for readability -->
<properties>
<property name="allowMultiline" value="true" />
</properties>
</rule>
<!-- Forbid backtick operator -->
<rule ref="Generic.PHP.BacktickOperator" />
<!-- Forbid short open tag -->
<rule ref="Generic.PHP.DisallowShortOpenTag" />
<!-- Forbid `php_sapi_name()` function -->
<rule ref="Generic.PHP.SAPIUsage" />
<!-- Disallow else if in favor of elseif -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
<type>error</type>
</rule>
<!-- 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" />
<!-- Force phpDoc alignment -->
<rule ref="Squiz.Commenting.DocCommentAlignment">
<!-- Allow extra spaces after star, i.e. for indented annotations -->
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceAfterStar" />
</rule>
<!-- Forbid `AND` and `OR`, require `&&` and `||` -->
<rule ref="Squiz.Operators.ValidLogicalOperators" />
<!-- 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 strings in `"` unless necessary -->
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<message>Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead</message>
</rule>
<!-- Forbid braces around string in `echo` -->
<rule ref="Squiz.Strings.EchoedStrings" />
<!-- Forbid spaces in type casts -->
<rule ref="Squiz.WhiteSpace.CastSpacing" />
<!-- Forbid blank line after function opening brace -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace" />
<!-- 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 PSR2 -> turning back off -->
<property name="ignoreBlankLines" value="false" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<!-- turned off by PSR2 -> turning back on -->
<severity>5</severity>
</rule>
</ruleset>