From 02b54602a67f7ef93a72b861952416014dada99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 8 Mar 2022 22:53:05 +0100 Subject: [PATCH] Enhancement: Configure single_class_element_per_statement fixer to enforce single class element for const statements --- CHANGELOG.md | 2 ++ src/RuleSet/Php74.php | 1 + src/RuleSet/Php80.php | 1 + src/RuleSet/Php81.php | 1 + test/Unit/RuleSet/Php74Test.php | 1 + test/Unit/RuleSet/Php80Test.php | 1 + test/Unit/RuleSet/Php81Test.php | 1 + 7 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e7b7d8..a688e814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ For a full diff see [`4.2.0...main`][4.2.0...main]. - Configured `no_unneeded_control_parentheses` fixer to include additional statements ([#583]), by [@localheinz] - Configured `ordered_class_elements` fixer to order more elements ([#584]), by [@localheinz] - Configured `phpdoc_align` fixer to align more tags ([#586]), by [@localheinz] +- Configured `single_class_element_per_statement` fixer to enforce single class element for `const` statements ([#587]), by [@localheinz] ## [`4.2.0`][4.2.0] @@ -609,6 +610,7 @@ For a full diff see [`d899e77...1.0.0`][d899e77...1.0.0]. [#583]: https://github.com/ergebnis/php-cs-fixer-config/pull/583 [#584]: https://github.com/ergebnis/php-cs-fixer-config/pull/584 [#586]: https://github.com/ergebnis/php-cs-fixer-config/pull/586 +[#587]: https://github.com/ergebnis/php-cs-fixer-config/pull/587 [@dependabot]: https://github.com/apps/dependabot [@linuxjuggler]: https://github.com/linuxjuggler diff --git a/src/RuleSet/Php74.php b/src/RuleSet/Php74.php index 654968c9..1f9fb551 100644 --- a/src/RuleSet/Php74.php +++ b/src/RuleSet/Php74.php @@ -610,6 +610,7 @@ final class Php74 extends AbstractRuleSet implements ExplicitRuleSet 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => [ 'elements' => [ + 'const', 'property', ], ], diff --git a/src/RuleSet/Php80.php b/src/RuleSet/Php80.php index 7a93d139..1a099240 100644 --- a/src/RuleSet/Php80.php +++ b/src/RuleSet/Php80.php @@ -610,6 +610,7 @@ final class Php80 extends AbstractRuleSet implements ExplicitRuleSet 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => [ 'elements' => [ + 'const', 'property', ], ], diff --git a/src/RuleSet/Php81.php b/src/RuleSet/Php81.php index 468ac4a2..1dfd8df6 100644 --- a/src/RuleSet/Php81.php +++ b/src/RuleSet/Php81.php @@ -611,6 +611,7 @@ final class Php81 extends AbstractRuleSet implements ExplicitRuleSet 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => [ 'elements' => [ + 'const', 'property', ], ], diff --git a/test/Unit/RuleSet/Php74Test.php b/test/Unit/RuleSet/Php74Test.php index 494e2f60..58a15086 100644 --- a/test/Unit/RuleSet/Php74Test.php +++ b/test/Unit/RuleSet/Php74Test.php @@ -616,6 +616,7 @@ final class Php74Test extends ExplicitRuleSetTestCase 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => [ 'elements' => [ + 'const', 'property', ], ], diff --git a/test/Unit/RuleSet/Php80Test.php b/test/Unit/RuleSet/Php80Test.php index c54ebfa6..83d19462 100644 --- a/test/Unit/RuleSet/Php80Test.php +++ b/test/Unit/RuleSet/Php80Test.php @@ -616,6 +616,7 @@ final class Php80Test extends ExplicitRuleSetTestCase 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => [ 'elements' => [ + 'const', 'property', ], ], diff --git a/test/Unit/RuleSet/Php81Test.php b/test/Unit/RuleSet/Php81Test.php index 88cd220f..bb45b38d 100644 --- a/test/Unit/RuleSet/Php81Test.php +++ b/test/Unit/RuleSet/Php81Test.php @@ -617,6 +617,7 @@ final class Php81Test extends ExplicitRuleSetTestCase 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => [ 'elements' => [ + 'const', 'property', ], ],