-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
155 lines (127 loc) · 6.23 KB
/
phpcs.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
<?xml version="1.0"?>
<ruleset name="" namespace="">
<description>Coding standard for this PHP project</description>
<php_version>7.3</php_version>
<!-- Generic excludes. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/tests/reports/*</exclude-pattern>
<autoload>./vendor/autoload.php</autoload>
<config name="installed_paths" value="vendor/slevomat/coding-standard,./"/>
<rule ref="Generic.PHP.Syntax" />
<rule ref="PSR1" />
<rule ref="PSR2">
<!-- The following exclude is in place to make some multiline function declarations saner. -->
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
</rule>
<rule ref="PSR12">
<!-- The following excludes are in place as PSR-12 was not properly defined earlier. -->
<exclude name="PSR12.Files.OpenTag.NotAlone" />
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock" />
<exclude name="PSR12.Files.FileHeader.IncorrectOrder" />
<exclude name="PSR12.Files.DeclareStatement" />
<exclude name="PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeColon" />
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName">
<!-- `it_can_look_like_this_in_test_methods()`. -->
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Generic.Files.EndFileNewline" />
<!-- Use 120 instead of old-fashioned 80. -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>
<rule ref="Generic.VersionControl.GitMergeConflict" />
<rule ref="Generic.Commenting.DocComment">
<exclude name="Generic.Commenting.DocComment.ParamNotFirst" />
<exclude name="Generic.Commenting.DocComment.TagValueIndent" />
<exclude name="Generic.Commenting.DocComment.ContentAfterOpen" />
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment">
<!-- PHP7 can comment itself better here in most cases. -->
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn" />
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
<!-- Allow skipping params when we want to use native typehints for some params. -->
<exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch" />
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint" />
<!-- Sometimes useless, e.g. `int` is okay and this tries to force `integer`. -->
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName" />
<!-- No alignment. -->
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType" />
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName" />
<!-- Sometimes the code itself is clear enough. -->
<exclude name="Squiz.Commenting.FunctionComment.Missing" />
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<!-- Force strict types. -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="declareOnFirstLine" value="true" />
<property name="linesCountAfterDeclare" value="1" />
<property name="spacesCountAroundEqualsSign" value="1" />
</properties>
</rule>
<!-- Make docblock typing redundant if declaration itself uses types. -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint" />
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint" />
<!-- Use `===` instead of `==`. -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators" />
<!-- Use `\global_function()` instead of `global_function()`. -->
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
<!-- Use `array<int>` instead of `int[]`. -->
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax" />
<!-- `[...] = foo()` instead of `list(...) = foo()`. -->
<rule ref="SlevomatCodingStandard.PHP.ShortList" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions" />
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" />
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
<properties>
<property name="spacesCountBeforeColon" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="linesCountBetweenAnnotationsGroups" value="1" />
<property name="linesCountBetweenDescriptionAndAnnotations" value="1" />
<property name="linesCountBeforeFirstContent" value="0" />
<property name="linesCountAfterLastContent" value="0" />
<property name="annotationsGroups" type="array">
<element value="
@phpcsSuppress,
@internal,
@deprecated,
@todo,
@fixme,
@see,
@link,
@var
" />
<element value="
@throws
" />
<element value="
@param
" />
<element value="
@return
" />
</property>
</properties>
</rule>
<rule ref="RaskCodingStandard" />
</ruleset>