-
Notifications
You must be signed in to change notification settings - Fork 34
/
phpcs.xml.dist
136 lines (124 loc) · 5.83 KB
/
phpcs.xml.dist
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
<?xml version="1.0"?>
<ruleset name="Planet4 Coding Standards">
<description>Generally-applicable sniffs for Planet4</description>
<!-- Show sniffs, progress -->
<arg value="sp"/>
<arg name="extensions" value="php"/>
<arg name="tab-width" value="4"/>
<config name="encoding" value="utf-8"/>
<!-- @todo: Temporary exclusions for 1st PR on 6967 -->
<rule ref="PSR12">
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
</rule>
<rule ref="Squiz.NamingConventions">
<exclude name="Squiz.NamingConventions.ValidFunctionName"/>
<exclude name="Squiz.NamingConventions.ValidVariableName"/>
</rule>
<!-- Deprecated WP features -->
<config name="minimum_supported_wp_version" value="6.1"/>
<rule ref="WordPress.WP.DeprecatedFunctions"/>
<rule ref="WordPress.WP.DeprecatedClasses"/>
<rule ref="WordPress.WP.DeprecatedParameters"/>
<rule ref="WordPress.WP.DeprecatedParameterValues"/>
<!-- Add rule for theme's textdomains -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="planet4-master-theme,planet4-master-theme-backend,planet4-blocks,planet4-blocks-backend,planet4-engagingnetworks,planet4-engagingnetworks-backend"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces">
<properties>
<property name="ignoreSpacesInComment" value="true"/>
</properties>
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<!-- <property name="lineLimit" value="80"/> -->
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
<!-- Functional -->
<rule ref="SlevomatCodingStandard.TypeHints">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
<exclude name="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax"/>
<!-- @todo: Temporary exclusions for 1st PR on 6967 -->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
</rule>
<!-- <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="declareOnFirstLine" value="false"/>
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule> -->
<rule ref="SlevomatCodingStandard.Classes.ClassStructure">
<exclude name="SlevomatCodingStandard.Classes.ClassStructure.IncorrectGroupOrder"/>
</rule>
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding"/>
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
<properties>
<property name="linesCountAfterOpeningBrace" value="0"/>
<property name="linesCountBeforeClosingBrace" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
<!-- Clean code -->
<rule ref="SlevomatCodingStandard.PHP">
<exclude name="SlevomatCodingStandard.PHP.DisallowReference"/>
<exclude name="SlevomatCodingStandard.PHP.RequireExplicitAssertion"/>
<exclude name="SlevomatCodingStandard.PHP.UselessParentheses"/>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedParameter"/>
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue"/>
<!-- Formatting -->
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment"/>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- exclude vendor dirs -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- @todo: Temporary exclude those rules for php8 job until php8.1 migration -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<properties>
<property name="enableMixedTypeHint" value="false"/>
<property name="enableUnionTypeHint" value="false"/>
<property name="enableIntersectionTypeHint" value="false"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<properties>
<property name="enableMixedTypeHint" value="false"/>
<property name="enableUnionTypeHint" value="false"/>
<property name="enableIntersectionTypeHint" value="false"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<properties>
<property name="enableMixedTypeHint" value="false"/>
<property name="enableUnionTypeHint" value="false"/>
<property name="enableIntersectionTypeHint" value="false"/>
<property name="enableNeverTypeHint" value="false"/>
</properties>
</rule>
</ruleset>