Skip to content

Commit

Permalink
#39 - trailing commas for match expressions (#79)
Browse files Browse the repository at this point in the history
* #39 - trailing commas for match

* #39 - trailing commas for match
  • Loading branch information
krzysztofrewak authored Jul 12, 2022
1 parent 717b521 commit cdca8c1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "library",
"require": {
"php": "^8.0",
"friendsofphp/php-cs-fixer": "^3.8.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.11.0"
"friendsofphp/php-cs-fixer": "^3.9.2",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.11.1"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.0",
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/Defaults/CommonRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class CommonRules extends Rules
"arrays",
"parameters",
"arguments",
"match",
],
],
NullableTypeDeclarationForDefaultNullValueFixer::class => true,
Expand Down
9 changes: 9 additions & 0 deletions tests/codestyle/fixtures/trailingCommas/actual.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,13 @@ public function testArrays(): array
3
];
}

public function match(int $i): int
{
return match ($i) {
1 => 1,
2 => 3,
default => 0
};
}
}
9 changes: 9 additions & 0 deletions tests/codestyle/fixtures/trailingCommas/expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ public function testArrays(): array
3,
];
}

public function match(int $i): int
{
return match ($i) {
1 => 1,
2 => 3,
default => 0,
};
}
}

0 comments on commit cdca8c1

Please sign in to comment.