forked from vimeo/psalm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
193 lines (158 loc) · 8.85 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
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
190
191
192
193
<?xml version="1.0"?>
<ruleset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
name="Psalm coding standard"
>
<description>The coding standard for Psalm.</description>
<!-- **************************************************************************************************************
* Configuration *
************************************************************************************************************** -->
<config name="php_version" value="70100"/>
<config name="installed_paths" value="../../slevomat/coding-standard"/>
<arg name="basepath" value="."/>
<!-- **************************************************************************************************************
* Files to include/exclude *
************************************************************************************************************** -->
<file>bin/</file>
<file>src/</file>
<file>tests/</file>
<!-- These are just examples and stub classes/files, so it doesn't really matter if they're PSR-2 compliant. -->
<exclude-pattern>src/Psalm/Internal/Stubs/</exclude-pattern>
<exclude-pattern>tests/fixtures/</exclude-pattern>
<!-- **************************************************************************************************************
* STANDARD: Generic *
************************************************************************************************************** -->
<!--
Restrict line length.
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Docs/Files/LineLengthStandard.xml
-->
<rule ref="Generic.Files.LineLength">
<exclude-pattern>tests</exclude-pattern>
<exclude-pattern>src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php</exclude-pattern>
</rule>
<!-- **************************************************************************************************************
* STANDARD: PSR2 *
************************************************************************************************************** -->
<rule ref="PSR2"/>
<!--
Namespace Declarations.
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/Docs/Namespaces/UseDeclarationStandard.xml
-->
<rule ref="PSR2.Namespaces.UseDeclaration">
<exclude-pattern>*</exclude-pattern>
</rule>
<!-- **************************************************************************************************************
* STANDARD: Squiz *
************************************************************************************************************** -->
<!--
The self keyword should be used instead of the current class name.
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Docs/Classes/SelfMemberReferenceStandard.xml
-->
<rule ref="Squiz.Classes.SelfMemberReference"/>
<!-- **************************************************************************************************************
* STANDARD: SlevomatCodingStandard *
************************************************************************************************************** -->
<!--
Handles enforcement and line spacing of declare(strict_types=1).
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsdeclarestricttypes-
-->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="declareOnFirstLine" type="bool" value="false"/>
<property name="linesCountBeforeDeclare" type="int" value="1"/>
<property name="linesCountAfterDeclare" type="int" value="1"/>
<property name="spacesCountAroundEqualsSign" type="int" value="0"/>
</properties>
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing"/>
</rule>
<!--
Requires only one namespace in a file.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesrequireonenamespaceinfile
-->
<rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/>
<!--
Enforces formatting of namespace.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesnamespacedeclaration-
-->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration"/>
<!--
Enforces number of lines before and after namespace.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesnamespacespacing-
-->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing">
<properties>
<property name="linesCountBeforeNamespace" type="int" value="1"/>
<property name="linesCountAfterNamespace" type="int" value="1"/>
</properties>
</rule>
<!--
Handle imports from namespaces.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesreferenceusednamesonly-
-->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="allowFullyQualifiedExceptions" type="bool" value="false"/>
<property name="allowFullyQualifiedGlobalFunctions" type="bool" value="false"/>
<property name="allowFullyQualifiedGlobalConstants" type="bool" value="false"/>
<property name="allowFullyQualifiedGlobalClasses" type="bool" value="false"/>
<property name="allowFullyQualifiedNameForCollidingClasses" type="bool" value="false"/>
<property name="allowFullyQualifiedNameForCollidingFunctions" type="bool" value="false"/>
<property name="allowFullyQualifiedNameForCollidingConstants" type="bool" value="false"/>
<property name="allowFallbackGlobalFunctions" type="bool" value="false"/>
<property name="allowFallbackGlobalConstants" type="bool" value="false"/>
<property name="allowPartialUses" type="bool" value="true"/>
<property name="searchAnnotations" type="bool" value="true"/>
</properties>
</rule>
<!--
Looks for unused imports from other namespaces.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesunuseduses-
-->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!--
Checks whether uses at the top of a file are alphabetically sorted.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesalphabeticallysorteduses-
-->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="psr12Compatible" type="bool" value="true"/>
<property name="caseSensitive" value="true"/>
</properties>
</rule>
<!--
Enforces configurable number of lines before/after/between use.
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesusespacing-
-->
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
<properties>
<property name="linesCountBetweenUseTypes" value="1"/>
</properties>
</rule>
<!--
Checks for missing return typehints and useless @return annotations.
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehint-
-->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<properties>
<property name="enableObjectTypeHint" type="bool" value="false"/>
<property name="enableStaticTypeHint" type="bool" value="false"/>
<property name="enableMixedTypeHint" type="bool" value="false"/>
<property name="enableUnionTypeHint" type="bool" value="false"/>
</properties>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
</rule>
<!--
Enforces consistent formatting of return typehints.
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehintspacing-
-->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
<properties>
<property name="spacesCountBeforeColon" value="0"/>
</properties>
</rule>
</ruleset>