Skip to content

Commit da42b5c

Browse files
fix(phpcs): align Slevomat ruleset with v8 (#7)
Updates the PHP_CodeSniffer ruleset to be compatible with breaking changes introduced in slevomat/coding-standard v8. - Replaced deprecated UnionTypeHintFormat with DNFTypeHintFormat. - Updated configuration keys for sniffs like RequireMultiLineMethodSignature. - Renamed DisallowTrailingMultiLineTernaryOperatorSniff.
1 parent caf0dca commit da42b5c

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

WPTechnix/ruleset.xml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@
9595
<!-- Type Hint Formatting -->
9696
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
9797
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
98-
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
99-
<properties>
100-
<property name="enable" value="true"/>
101-
<property name="withSpaces" value="no"/>
102-
<property name="shortNullable" value="yes"/>
103-
<property name="nullPosition" value="last"/>
104-
</properties>
105-
</rule>
10698
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
10799
<properties>
108100
<property name="enable" value="true"/>
@@ -112,6 +104,7 @@
112104
<property name="nullPosition" value="last"/>
113105
</properties>
114106
</rule>
107+
115108
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
116109

117110
<!-- Disallow Array Type Hint Syntax (use generics in PHPDoc) -->
@@ -197,8 +190,7 @@
197190
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/>
198191
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace">
199192
<properties>
200-
<property name="spacesCountInsideBrackets" type="int" value="0"/>
201-
<property name="spacesCountAfterComma" type="int" value="1"/>
193+
<property name="spacesAroundBrackets" value="0"/>
202194
<property name="enableEmptyArrayCheck" value="true"/>
203195
</properties>
204196
</rule>
@@ -238,7 +230,7 @@
238230
<rule ref="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature">
239231
<properties>
240232
<property name="minLineLength" value="121"/>
241-
<property name="minParameterCount" value="4"/>
233+
<property name="minParametersCount" value="4"/>
242234
<property name="withPromotedProperties" value="true"/>
243235
</properties>
244236
</rule>
@@ -279,11 +271,13 @@
279271
<!-- Ternary Operators -->
280272
<rule ref="SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator">
281273
<properties>
274+
<!-- PSR-12 typical line length limit -->
282275
<property name="lineLengthLimit" value="120"/>
283-
<property name="minExpressionsInOneLine" value="2"/>
276+
<property name="minExpressionsLength" value="null"/>
284277
</properties>
285278
</rule>
286279

280+
287281
<!-- ################################################################## -->
288282
<!-- ## EXCEPTION HANDLING ## -->
289283
<!-- ################################################################## -->
@@ -523,7 +517,7 @@
523517
</rule>
524518

525519
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
526-
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperatorSniff"/>
520+
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator"/>
527521
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
528522

529523
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">

0 commit comments

Comments
 (0)