Skip to content

Commit b4dcf40

Browse files
committed
feat: upgrade slevomat coding standard and use new union type sniff
1 parent e1467ae commit b4dcf40

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/Ramsey/ruleset.xml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
9393

9494
<!-- Require comma after last element in a multi-line method/function call -->
95-
<rule ref="SlevomatCodingStandard.Functions.TrailingCommaInCall"/>
95+
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>
9696

9797
<!-- Require arrow functions for simple functions. -->
9898
<rule ref="SlevomatCodingStandard.Functions.RequireArrowFunction"/>
@@ -186,11 +186,11 @@
186186
<!-- Require consistent spacing for control structures (add a line break) -->
187187
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
188188
<properties>
189-
<property name="tokensToCheck" type="array">
190-
<element value="T_RETURN"/>
191-
<element value="T_THROW"/>
192-
<element value="T_BREAK"/>
193-
<element value="T_CONTINUE"/>
189+
<property name="jumpStatements" type="array">
190+
<element value="break"/>
191+
<element value="continue"/>
192+
<element value="return"/>
193+
<element value="throw"/>
194194
</property>
195195
</properties>
196196
</rule>
@@ -310,7 +310,17 @@
310310
</rule>
311311

312312
<!-- Require presence of declare(strict_types=1) -->
313-
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing"/>
313+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
314+
<properties>
315+
<!--
316+
Two newlines accounts for 1 newline, the file header comment,
317+
and 1 more newline before declare(strict_types=1).
318+
-->
319+
<property name="linesCountBeforeDeclare" value="2"/>
320+
<property name="linesCountAfterDeclare" value="1"/>
321+
<property name="spacesCountAroundEqualsSign" value="0"/>
322+
</properties>
323+
</rule>
314324

315325
<!-- Require use of short versions of scalar types (i.e. int instead of integer) -->
316326
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
@@ -421,6 +431,13 @@
421431
<!-- Require space around logical operators -->
422432
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
423433

434+
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
435+
<properties>
436+
<property name="withSpaces" value="yes"/>
437+
<property name="nullPosition" value="last"/>
438+
</properties>
439+
</rule>
440+
424441
<!-- Forbid spaces around '->' operator -->
425442
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
426443
<properties>

0 commit comments

Comments
 (0)