From cca79006fa86b3c1e98512d1112adb3aa0eb3ff2 Mon Sep 17 00:00:00 2001 From: Kei Date: Tue, 27 Aug 2024 08:25:38 +0700 Subject: [PATCH] Update `trailing_comma_in_multiline` --- src/RuleSet/Sets/Relax.php | 3 +-- tests/Fixtures/Ruleset/realodixspec_expected.php | 2 +- tests/Fixtures/Ruleset/relax-commonbox_expected.php | 2 +- tests/Fixtures/Ruleset/relax_expected.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/RuleSet/Sets/Relax.php b/src/RuleSet/Sets/Relax.php index 050447f..b0ddc72 100644 --- a/src/RuleSet/Sets/Relax.php +++ b/src/RuleSet/Sets/Relax.php @@ -84,8 +84,7 @@ public function mainRules(): array 'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['class', 'function', 'const']], 'single_import_per_statement' => ['group_to_single_imports' => false], 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], - // TODO: Add 'match' & 'parameters' when PHP 8.0+ is required - 'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments']], + 'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays', 'match', 'parameters']], 'unary_operator_spaces' => ['only_dec_inc' => true], 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], 'phpdoc_align' => [ diff --git a/tests/Fixtures/Ruleset/realodixspec_expected.php b/tests/Fixtures/Ruleset/realodixspec_expected.php index ced5a15..ce7684b 100644 --- a/tests/Fixtures/Ruleset/realodixspec_expected.php +++ b/tests/Fixtures/Ruleset/realodixspec_expected.php @@ -53,7 +53,7 @@ class RealodixSpec public function __construct( public int $a, public ?int $b = 3600, // 1 hour... - public string $c = 'Hello World!' + public string $c = 'Hello World!', ) {} /** diff --git a/tests/Fixtures/Ruleset/relax-commonbox_expected.php b/tests/Fixtures/Ruleset/relax-commonbox_expected.php index 6ffb334..2f16a5d 100644 --- a/tests/Fixtures/Ruleset/relax-commonbox_expected.php +++ b/tests/Fixtures/Ruleset/relax-commonbox_expected.php @@ -227,7 +227,7 @@ public function getBar() class SingleLineEmptyBody { public function __construct( - int $ruleSet + int $ruleSet, ) {} public function basic__single_line_empty_body() {} diff --git a/tests/Fixtures/Ruleset/relax_expected.php b/tests/Fixtures/Ruleset/relax_expected.php index 626f19a..0344f6d 100644 --- a/tests/Fixtures/Ruleset/relax_expected.php +++ b/tests/Fixtures/Ruleset/relax_expected.php @@ -821,7 +821,7 @@ function om_ensure_fully_multiline($a = 10, function om_ensure_single_line( $a = 10, $b = 20, - $c = 30 + $c = 30, ) {} sample( 1,