Skip to content

Commit d2a4df7

Browse files
committed
Add new rules and remove old PHP support
1 parent 31efdbc commit d2a4df7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Rules/Parts/phpcs-slevomat.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
<config name="installed_paths" value="../../slevomat/coding-standard"/>
55

6+
<rule ref="SlevomatCodingStandard.Arrays.ArrayAccess"/> <!-- No spaces between variable and [] or between []s -->
67
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/> <!-- Multiline array must have trailing comma -->
78
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/>
89
<rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing" /> <!-- Checks spacing for type hints for Enums -->
@@ -67,6 +68,7 @@
6768
<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/> <!-- Require non-capturing catch when the variable with exception is not used. -->
6869
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration"/> <!-- Spacing around PHP 7.4 arrow functions -->
6970
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/> <!-- Empty function must have a comment why is empty -->
71+
<rule ref="SlevomatCodingStandard.Functions.NamedArgumentSpacing"/> <!-- Verify spaces around names of arguments and values -->
7072
<rule ref="SlevomatCodingStandard.Functions.RequireMultiLineCall"/> <!-- Can fix when max line length of function call is exceeded -->
7173
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/> <!-- PHP 7.3+ add trailing comma in multiline function call -->
7274
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse"/> <!-- PHP 8.0+ add trailing comma in multiline closure use declaration -->

Rules/phpcs-strict.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<rule ref="SlevomatCodingStandard.Functions.RequireSingleLineCall"/> <!-- If function call can be placed on single line, it will force it -->
6767
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/> <!-- Disallow use == or != and must use === and !== -->
6868
<rule ref="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators"/> <!-- Disable use of $i++ must use $i += 1 etc.. -->
69+
<rule ref="SlevomatCodingStandard.TypeHints.ClassConstantTypeHint"/> <!-- Requires type hint for class constants -->
6970
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"> <!-- File must have declare strict types with correct spacing -->
7071
<properties>
7172
<property name="linesCountBeforeDeclare" value="1"/>
@@ -101,9 +102,10 @@
101102
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation">
102103
<severity>0</severity>
103104
</rule>
104-
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat"> <!-- Checks format of union type hints -->
105+
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat"> <!-- Checks format of union type hints -->
105106
<properties>
106-
<property name="withSpaces" value="false"/>
107+
<property name="withSpacesAroundOperators" value="no"/>
108+
<property name="withSpacesInsideParentheses" value="no"/>
107109
<property name="shortNullable" value="true"/>
108110
<property name="nullPosition" value="last"/>
109111
</properties>

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.2 || ^8.0",
15-
"slevomat/coding-standard": "^8.11.0"
14+
"php": "^7.4 || ^8.0",
15+
"slevomat/coding-standard": "^8.16.0"
1616
},
1717
"config": {
1818
"allow-plugins": {

0 commit comments

Comments
 (0)