Skip to content

Commit

Permalink
Union types
Browse files Browse the repository at this point in the history
Add a temporary workaround to avoid spaces between union types,
when PHP 8+.
  • Loading branch information
cristianoc72 committed Feb 23, 2021
1 parent e12940f commit d9d8141
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace phootwork\fixer;

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

public function getRules(): array {
return [
$rules = [
'align_multiline_comment' => [
'comment_type' => 'phpdocs_only'
],
Expand Down Expand Up @@ -86,5 +86,12 @@ public function getRules(): array {
'visibility_required' => true,
'whitespace_after_comma_in_array' => true
];

if (phpversion() >= '8.0') {
//temporary workaround to avoid spaces between PHP 8 union types
$rules['binary_operator_spaces']['operators'] = ['|' => null];
}

return $rules;
}
}

0 comments on commit d9d8141

Please sign in to comment.