Skip to content

Commit d9d8141

Browse files
committed
Union types
Add a temporary workaround to avoid spaces between union types, when PHP 8+.
1 parent e12940f commit d9d8141

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Config.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
namespace phootwork\fixer;
33

44
use PhpCsFixer\Config as BaseConfig;
@@ -13,7 +13,7 @@ public function __construct() {
1313
}
1414

1515
public function getRules(): array {
16-
return [
16+
$rules = [
1717
'align_multiline_comment' => [
1818
'comment_type' => 'phpdocs_only'
1919
],
@@ -86,5 +86,12 @@ public function getRules(): array {
8686
'visibility_required' => true,
8787
'whitespace_after_comma_in_array' => true
8888
];
89+
90+
if (phpversion() >= '8.0') {
91+
//temporary workaround to avoid spaces between PHP 8 union types
92+
$rules['binary_operator_spaces']['operators'] = ['|' => null];
93+
}
94+
95+
return $rules;
8996
}
9097
}

0 commit comments

Comments
 (0)