-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpcs.xml
125 lines (94 loc) · 5.95 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
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="publicwhip-ruleset">
<description>PublicWhip Ruleset.</description>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".php_cs.cache"/>
<arg name="colors"/>
<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>
<!-- Directories to be checked -->
<file>src</file>
<file>tests</file>
<file>v1migrationUtils</file>
<exclude-pattern>./web/*</exclude-pattern>
<exclude-pattern>./vendor/*</exclude-pattern>
<exclude-pattern>./.idea/</exclude-pattern>
<exclude-pattern>./originalPublicWhipCode/</exclude-pattern>
<!-- Load the additional coding standards -->
<config name="installed_paths" value="vendor/slevomat/coding-standard,vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis,vendor/doctrine/coding-standard/lib"/>
<!-- Code MUST follow all rules outlined in PSR-12. -->
<rule ref="PSR12"/>
<rule ref="VariableAnalysis"/>
<rule ref="Doctrine">
<!-- Overriden by SlevomatCodingStandard default -->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat"/>
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectAnnotationsGroup"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing.IncorrectWhitespaceBeforeColon"/>
<!-- Dislike the alignments -->
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
<!-- Spaces after casts look wrong -->
<exclude name="Generic.Formatting.SpaceAfterCast.NoSpace"/>
<!-- Too many false positives -->
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFallbackGlobalName"/>
<!-- Too many spaces -->
<exclude name="Squiz.Arrays.ArrayDeclaration.NoSpaceAfterComma"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
<exclude name="Generic.Formatting.SpaceAfterNot.Incorrect"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
<exclude name="Squiz.Commenting.DocCommentAlignment.NoSpaceAfterStar"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
<!-- Can be useful for quick reference as everything is together -->
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessReturnAnnotation"/>
</rule>
<!-- And all those in the SlevomatCodingStandard -->
<rule ref="SlevomatCodingStandard">
<!-- No need for trailing commas -->
<exclude name="SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma"/>
<!-- Conflicts with PSR2.Classes.ClassDeclaration.CloseBraceAfterBody part of PSR12 -->
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineBeforeClosingBrace"/>
<!-- Prefer to keep the Abstract/Trait prefix and Interface/Exception suffixes -->
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
<!-- Disabled as it removes phpcs:disable lines.-->
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountAfterLastContent"/>
<!-- Yoda style conditions we prefer -->
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison.DisallowedYodaComparison"/>
<!-- We prefer new to be used with parentheses -->
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses.UselessParentheses"/>
<!-- Seems to be problematic with tests -->
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName"/>
<!-- No need for trailing commas -->
<exclude name="SlevomatCodingStandard.Functions.TrailingCommaInCall.MissingTrailingComma"/>
<!-- Unless it is for performance reasons, no need to have these fully qualified -->
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants.NonFullyQualified"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions.NonFullyQualifiedException"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
<!-- We want to be able to reference other namespaces -->
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces"/>
<!-- Prefer single line ternary operators -->
<exclude name="SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator.MultiLineTernaryOperatorNotUsed"/>
<!-- Allow short ternary operator -->
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator.DisallowedShortTernaryOperator"/>
<!-- Allow ++ etc -->
<exclude name="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators"/>
<!-- We want a blank line between the open tag and declare -->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectWhitespaceBetweenOpenTagAndDeclare"/>
</rule>
<!-- Look for unused imports from other namespaces -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- ensure we are looking for Linux line endings -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
</ruleset>