-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpcs_codestyle.xml
158 lines (142 loc) · 6.53 KB
/
phpcs_codestyle.xml
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
<?xml version="1.0"?>
<ruleset name="CodeStyle">
<description>Check for code style.</description>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/>
<arg name="cache"/>
<arg value="sp"/>
<config name="installed_paths" value="vendor/slevomat/coding-standard"/>
<exclude-pattern>*.js</exclude-pattern>
<rule ref="PSR12">
<exclude name="PSR12.Classes.ClosingBrace"/>
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="180"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Files.LineLength">
<properties>
<property name="lineLengthLimit" value="180"/>
<property name="ignoreComments" value="true"/>
<property name="ignoreImports" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" type="bool" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall" />
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration" />
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="withSpaces" value="no"/>
</properties>
</rule>
<!-- Don't hide tokenizer exceptions -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<rule ref="Squiz.Arrays.ArrayDeclaration">
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed" />
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" />
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" />
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned" />
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Squiz.ControlStructures.ElseIfDeclaration"/>
<rule ref="Squiz.Commenting.BlockComment">
<exclude name="Squiz.Commenting.BlockComment.SingleLine"/>
<exclude name="Squiz.Commenting.BlockComment.WrongStart"/>
<exclude name="Squiz.Commenting.BlockComment.NoEmptyLineAfter"/>
</rule>
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
<rule ref="Squiz.Commenting.InlineComment">
<exclude name="Squiz.Commenting.InlineComment.DocBlock"/>
</rule>
<!-- <rule ref="Squiz.Commenting.LongConditionClosingComment"/>-->
<rule ref="Squiz.Commenting.PostStatementComment"/>
<rule ref="Squiz.Formatting.OperatorBracket"/>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
<rule ref="Squiz.Operators.ComparisonOperatorUsage">
<exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed"/>
<exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue"/>
</rule>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound"/>
</rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<exclude name="Squiz.WhiteSpace.OperatorSpacing.SpacingBefore"/>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<rule ref="PSR2.Methods.MethodDeclaration"/>
<rule ref="PSR2.Files.EndFileNewline"/>
<rule ref="PSR12.Files.OpenTag"/>
<rule ref="Zend.Files.ClosingTag"/>
<!-- PEAR uses warnings for inline control structures, so switch back to errors -->
<rule ref="Generic.ControlStructures.InlineControlStructure">
<properties>
<property name="error" value="true"/>
</properties>
</rule>
<!-- Check var names, but we don't want leading underscores for private vars -->
<rule ref="Squiz.NamingConventions.ValidVariableName"/>
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
<severity>0</severity>
</rule>
<!-- Only one argument per line in multi-line function calls -->
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false"/>
</properties>
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
</rule>
<!-- Ban some functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="is_null" value="null"/>
<element key="create_function" value="null"/>
<element key="isset" value="null"/>
<element key="empty" value="null"/>
</property>
</properties>
</rule>
<!-- Ignore rules in certain conditions -->
<rule ref="Squiz.Arrays.ArrayDeclaration.KeySpecified">
<exclude-pattern>tests/**/*.php</exclude-pattern>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName">
<exclude-pattern>tests/**/*.php</exclude-pattern>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
<exclude-pattern>src/*.php</exclude-pattern>
<exclude-pattern>tests/**/*.php</exclude-pattern>
</rule>
<rule ref="Squiz.NamingConventions.ValidVariableName" />
<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
<severity>0</severity>
</rule>
</ruleset>