From 7e044ea74e86ad8bf5f70e70ffa88364ea8b3a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 23 Feb 2025 20:01:14 +0100 Subject: [PATCH] Enhancement: Add constant to elements option of type_declaration_spaces fixer --- CHANGELOG.md | 2 ++ src/RuleSet/Php71.php | 1 + src/RuleSet/Php72.php | 1 + src/RuleSet/Php73.php | 1 + src/RuleSet/Php74.php | 1 + src/RuleSet/Php80.php | 1 + src/RuleSet/Php81.php | 1 + src/RuleSet/Php82.php | 1 + src/RuleSet/Php83.php | 1 + src/RuleSet/Php84.php | 1 + test/Unit/RuleSet/Php71Test.php | 1 + test/Unit/RuleSet/Php72Test.php | 1 + test/Unit/RuleSet/Php73Test.php | 1 + test/Unit/RuleSet/Php74Test.php | 1 + test/Unit/RuleSet/Php80Test.php | 1 + test/Unit/RuleSet/Php81Test.php | 1 + test/Unit/RuleSet/Php82Test.php | 1 + test/Unit/RuleSet/Php83Test.php | 1 + test/Unit/RuleSet/Php84Test.php | 1 + 19 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8b6fcff..0b2b8cd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ For a full diff see [`6.43.1...main`][6.43.1...main]. ### Changed - Updated `friendsofphp/php-cs-fixer` ([#1177]), by [@dependabot] +- Added `constant` to `elements` option of `type_declaration_spaces` fixer ([#1178]), by [@localheinz] ## [`6.43.1`][6.43.1] @@ -1882,6 +1883,7 @@ For a full diff see [`d899e77...1.0.0`][d899e77...1.0.0]. [#1170]: https://github.com/ergebnis/php-cs-fixer-config/pull/1170 [#1173]: https://github.com/ergebnis/php-cs-fixer-config/pull/1173 [#1177]: https://github.com/ergebnis/php-cs-fixer-config/pull/1177 +[#1178]: https://github.com/ergebnis/php-cs-fixer-config/pull/1178 [@dependabot]: https://github.com/apps/dependabot [@linuxjuggler]: https://github.com/linuxjuggler diff --git a/src/RuleSet/Php71.php b/src/RuleSet/Php71.php index 5f4bfbbb..07a2d0ec 100644 --- a/src/RuleSet/Php71.php +++ b/src/RuleSet/Php71.php @@ -853,6 +853,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', ], ], diff --git a/src/RuleSet/Php72.php b/src/RuleSet/Php72.php index c85f722f..8d1fae71 100644 --- a/src/RuleSet/Php72.php +++ b/src/RuleSet/Php72.php @@ -853,6 +853,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', ], ], diff --git a/src/RuleSet/Php73.php b/src/RuleSet/Php73.php index 756f1ac2..ffffac4a 100644 --- a/src/RuleSet/Php73.php +++ b/src/RuleSet/Php73.php @@ -854,6 +854,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', ], ], diff --git a/src/RuleSet/Php74.php b/src/RuleSet/Php74.php index 94513845..53601f6c 100644 --- a/src/RuleSet/Php74.php +++ b/src/RuleSet/Php74.php @@ -858,6 +858,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/src/RuleSet/Php80.php b/src/RuleSet/Php80.php index 527dcf32..78460fe2 100644 --- a/src/RuleSet/Php80.php +++ b/src/RuleSet/Php80.php @@ -879,6 +879,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/src/RuleSet/Php81.php b/src/RuleSet/Php81.php index 528c6c4b..e858964d 100644 --- a/src/RuleSet/Php81.php +++ b/src/RuleSet/Php81.php @@ -882,6 +882,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/src/RuleSet/Php82.php b/src/RuleSet/Php82.php index 649c55d5..c624477a 100644 --- a/src/RuleSet/Php82.php +++ b/src/RuleSet/Php82.php @@ -882,6 +882,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/src/RuleSet/Php83.php b/src/RuleSet/Php83.php index c654151b..24da3eee 100644 --- a/src/RuleSet/Php83.php +++ b/src/RuleSet/Php83.php @@ -882,6 +882,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/src/RuleSet/Php84.php b/src/RuleSet/Php84.php index 8239d7c9..a491bffe 100644 --- a/src/RuleSet/Php84.php +++ b/src/RuleSet/Php84.php @@ -882,6 +882,7 @@ public static function create(): RuleSet 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/test/Unit/RuleSet/Php71Test.php b/test/Unit/RuleSet/Php71Test.php index 484f3396..1b944041 100644 --- a/test/Unit/RuleSet/Php71Test.php +++ b/test/Unit/RuleSet/Php71Test.php @@ -876,6 +876,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', ], ], diff --git a/test/Unit/RuleSet/Php72Test.php b/test/Unit/RuleSet/Php72Test.php index fb31dc2c..b9a3609e 100644 --- a/test/Unit/RuleSet/Php72Test.php +++ b/test/Unit/RuleSet/Php72Test.php @@ -876,6 +876,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', ], ], diff --git a/test/Unit/RuleSet/Php73Test.php b/test/Unit/RuleSet/Php73Test.php index e839a3af..12b91425 100644 --- a/test/Unit/RuleSet/Php73Test.php +++ b/test/Unit/RuleSet/Php73Test.php @@ -877,6 +877,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', ], ], diff --git a/test/Unit/RuleSet/Php74Test.php b/test/Unit/RuleSet/Php74Test.php index e4049714..445cd521 100644 --- a/test/Unit/RuleSet/Php74Test.php +++ b/test/Unit/RuleSet/Php74Test.php @@ -881,6 +881,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/test/Unit/RuleSet/Php80Test.php b/test/Unit/RuleSet/Php80Test.php index deddf364..714fd293 100644 --- a/test/Unit/RuleSet/Php80Test.php +++ b/test/Unit/RuleSet/Php80Test.php @@ -902,6 +902,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/test/Unit/RuleSet/Php81Test.php b/test/Unit/RuleSet/Php81Test.php index 06d80749..e3ab54be 100644 --- a/test/Unit/RuleSet/Php81Test.php +++ b/test/Unit/RuleSet/Php81Test.php @@ -905,6 +905,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/test/Unit/RuleSet/Php82Test.php b/test/Unit/RuleSet/Php82Test.php index a6bca9c4..04c4432c 100644 --- a/test/Unit/RuleSet/Php82Test.php +++ b/test/Unit/RuleSet/Php82Test.php @@ -905,6 +905,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/test/Unit/RuleSet/Php83Test.php b/test/Unit/RuleSet/Php83Test.php index 51a0b47a..d7534b10 100644 --- a/test/Unit/RuleSet/Php83Test.php +++ b/test/Unit/RuleSet/Php83Test.php @@ -905,6 +905,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ], diff --git a/test/Unit/RuleSet/Php84Test.php b/test/Unit/RuleSet/Php84Test.php index bc3ca3cf..d1b8a814 100644 --- a/test/Unit/RuleSet/Php84Test.php +++ b/test/Unit/RuleSet/Php84Test.php @@ -905,6 +905,7 @@ protected function expectedRules(): Rules 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => [ + 'constant', 'function', 'property', ],