Skip to content

Commit 09400f5

Browse files
committed
Feat: Replace UnionTypeHintFormatSniff with TypesSpacesFixer
1 parent 139faea commit 09400f5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ecs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
136136
use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
137137
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
138+
use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
138139
use SlevomatCodingStandard\Sniffs\Classes\RequireConstructorPropertyPromotionSniff;
139140
use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;
140141
use SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff;
@@ -143,7 +144,6 @@
143144
use SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff;
144145
use SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff;
145146
use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff;
146-
use SlevomatCodingStandard\Sniffs\TypeHints\UnionTypeHintFormatSniff;
147147
use Symplify\CodingStandard\Fixer\Commenting\ParamReturnAndVarTagMalformsFixer;
148148
use Symplify\EasyCodingStandard\Config\ECSConfig;
149149

@@ -263,6 +263,8 @@
263263
FopenFlagsFixer::class,
264264
// Add missing space between function's argument and its typehint.
265265
TypeDeclarationSpacesFixer::class,
266+
// None space should be around union type and intersection type operators.
267+
TypesSpacesFixer::class,
266268
// Function `implode` must be called with 2 arguments in the documented order.
267269
ImplodeCallFixer::class,
268270
// Lambda must not import variables it doesn't use.
@@ -505,8 +507,6 @@
505507
'use_trait',
506508
],
507509
])
508-
// Format union types
509-
->withConfiguredRule(UnionTypeHintFormatSniff::class, ['withSpaces' => 'no'])
510510
->withSkip([
511511
// We allow empty catch statements (but they must have comment - see EmptyCatchCommentSniff)
512512
EmptyStatementSniff::class . '.DetectedCatch' => null,

tests/Integration/Fixtures/NewPhpFeatures.correct.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class NewPhpFeatures
99
}
1010

1111
public function php80features(
12-
string|bool $foo, // UnionTypeHintFormatSniff
12+
string|bool $foo, // TypesSpacesFixer
1313
int $bar, // RequireTrailingCommaInDeclarationSniff
1414
): string|bool {
1515
$value = mt_rand(

tests/Integration/Fixtures/NewPhpFeatures.wrong.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class NewPhpFeatures
1212
}
1313

1414
public function php80features(
15-
string | bool $foo, // UnionTypeHintFormatSniff
15+
string | bool $foo, // TypesSpacesFixer
1616
int $bar // RequireTrailingCommaInDeclarationSniff
1717
): string | bool {
1818
$value = mt_rand(

0 commit comments

Comments
 (0)