-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
137 lines (120 loc) · 6.71 KB
/
phpcs.xml.dist
File metadata and controls
137 lines (120 loc) · 6.71 KB
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
<?xml version="1.0"?>
<ruleset>
<arg name="basepath" value="." />
<arg name="extensions" value="php" />
<arg name="parallel" value="80" />
<arg name="cache" value=".phpcs-cache" />
<arg name="colors" />
<!-- Ignore warnings (n), show progress of the run (p), and show sniff names (s) -->
<arg value="nps"/>
<file>config</file>
<file>src</file>
<file>tests</file>
<file>rector.php</file>
<!-- Target minimum supported PHP version -->
<config name="php_version" value="80100"/>
<!-- ****************************************** -->
<!-- Import rules from doctrine/coding-standard -->
<!-- ****************************************** -->
<rule ref="Doctrine">
<!-- *********************************** -->
<!-- Exclude sniffs that cause BC breaks -->
<!-- *********************************** -->
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming" />
<!-- **************************************** -->
<!-- Exclude sniffs that force unwanted style -->
<!-- **************************************** -->
<exclude name="Generic.Formatting.MultipleStatementAlignment" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
<!-- Allow short nullable syntax for non-union types -->
<exclude name="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat.DisallowedShortNullable" />
<!-- ********************* -->
<!-- Exclude broken sniffs -->
<!-- ********************* -->
<!-- Sniff currently broken when casting arrays, see https://github.com/squizlabs/PHP_CodeSniffer/issues/2937#issuecomment-615498860 -->
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline" />
</rule>
<!-- **************************************** -->
<!-- Enable rules not enforced by Doctrine CS -->
<!-- **************************************** -->
<!-- Require arrow functions where possible -->
<rule ref="SlevomatCodingStandard.Functions.RequireArrowFunction"/>
<!-- Forbid fully qualified names even for colliding names -->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="allowFallbackGlobalConstants" value="false"/>
<property name="allowFallbackGlobalFunctions" value="false"/>
<property name="allowFullyQualifiedGlobalClasses" value="false"/>
<property name="allowFullyQualifiedGlobalConstants" value="false"/>
<property name="allowFullyQualifiedGlobalFunctions" value="false"/>
<property phpcs-only="true" name="allowFullyQualifiedNameForCollidingClasses" value="false"/>
<property phpcs-only="true" name="allowFullyQualifiedNameForCollidingConstants" value="false"/>
<property phpcs-only="true" name="allowFullyQualifiedNameForCollidingFunctions" value="false"/>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- Allow single conditional in loop without requiring early exit -->
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
<properties>
<property name="ignoreStandaloneIfInScope" value="true"/>
</properties>
</rule>
<!-- ****************************************************** -->
<!-- Don't require annotations to specify traversable types -->
<!-- ****************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- ************************************************************************** -->
<!-- Require type hints for all parameters, properties, and return types in src -->
<!-- ************************************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint">
<exclude-pattern>tests</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint">
<exclude-pattern>tests</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint">
<exclude-pattern>tests</exclude-pattern>
</rule>
<!-- *********************************************************** -->
<!-- Require native type hints for all code without a BC promise -->
<!-- *********************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<exclude-pattern>src</exclude-pattern>
</rule>
<!-- ************************************************************* -->
<!-- Ignore errors for certain files where this is part of the API -->
<!-- ************************************************************* -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>/src/GridFS/StreamWrapper</exclude-pattern>
<exclude-pattern>/tests/DocumentationExamplesTest.php</exclude-pattern>
<exclude-pattern>/tests/GridFS/UnusableStream.php</exclude-pattern>
<exclude-pattern>/tests/SpecTests/ClientSideEncryption/Prose*</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>/examples</exclude-pattern>
<exclude-pattern>/tests/PHPUnit/ConstraintTrait.php</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>/examples</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>/tests/SpecTests/ClientSideEncryption/Prose*</exclude-pattern>
</rule>
<!-- **************************************** -->
<!-- Exclude certain rules for codec examples -->
<!-- **************************************** -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>/docs/examples/codecs/</exclude-pattern>
</rule>
</ruleset>