diff --git a/src/RuleSet/Sets/Relax.php b/src/RuleSet/Sets/Relax.php index aab8bc9..3eb55ec 100644 --- a/src/RuleSet/Sets/Relax.php +++ b/src/RuleSet/Sets/Relax.php @@ -62,6 +62,14 @@ public function mainRules(): array 'default' => 'single_space', 'operators' => ['=>' => 'at_least_single_space'], ], + 'class_attributes_separation' => [ + 'elements' => [ + 'trait_import' => 'none', + 'const' => 'none', + 'property' => 'one', + 'method' => 'one', + ], + ], 'class_definition' => ['inline_constructor_arguments' => false, 'space_before_parenthesis' => true], 'braces_position' => ['anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end'], 'function_declaration' => ['closure_fn_spacing' => 'none'], diff --git a/tests/Fixtures/Ruleset/realodixspec_actual.php b/tests/Fixtures/Ruleset/realodixspec_actual.php index beed595..50a4da8 100644 --- a/tests/Fixtures/Ruleset/realodixspec_actual.php +++ b/tests/Fixtures/Ruleset/realodixspec_actual.php @@ -24,6 +24,11 @@ class RealodixSpec /** @var int */ const C1 = 1; + const C3 = 3; + const C4 = 4; + + const C5 = 5; + /** @var int */ protected static $protStatProp; diff --git a/tests/Fixtures/Ruleset/realodixspec_expected.php b/tests/Fixtures/Ruleset/realodixspec_expected.php index 47cbd4d..341b353 100644 --- a/tests/Fixtures/Ruleset/realodixspec_expected.php +++ b/tests/Fixtures/Ruleset/realodixspec_expected.php @@ -24,6 +24,10 @@ class RealodixSpec /** @var int */ const C1 = 1; + const C3 = 3; + const C4 = 4; + const C5 = 5; + /** @var int */ protected static $protStatProp; diff --git a/tests/Fixtures/Ruleset/relax-commonbox_actual.php b/tests/Fixtures/Ruleset/relax-commonbox_actual.php index e921dd9..51bfeae 100644 --- a/tests/Fixtures/Ruleset/relax-commonbox_actual.php +++ b/tests/Fixtures/Ruleset/relax-commonbox_actual.php @@ -73,13 +73,31 @@ class ClassAttributesSeparation use trait_b; private $a; private $b; + /** + * @var int + */ + const C2 = 2; + /** @var int */ - const SECOND = 1; - /** @var int */ - const MINUTE = 60; + const C1 = 1; + + const C3 = 3; + const C4 = 4; + + + const C5 = 5; protected function foo() {} protected function bar() {} } +enum ClassAttributesSeparationEnum +{ + case Case1; + + case Case2; + case Case3; + + case Case4; +} /** * class_definition diff --git a/tests/Fixtures/Ruleset/relax-commonbox_expected.php b/tests/Fixtures/Ruleset/relax-commonbox_expected.php index dd9ef7e..e341448 100644 --- a/tests/Fixtures/Ruleset/relax-commonbox_expected.php +++ b/tests/Fixtures/Ruleset/relax-commonbox_expected.php @@ -73,16 +73,31 @@ class ClassAttributesSeparation private $b; - /** @var int */ - const SECOND = 1; + /** + * @var int + */ + const C2 = 2; /** @var int */ - const MINUTE = 60; + const C1 = 1; + + const C3 = 3; + const C4 = 4; + const C5 = 5; protected function foo() {} protected function bar() {} } +enum ClassAttributesSeparationEnum +{ + case Case1; + + case Case2; + case Case3; + + case Case4; +} /** * class_definition @@ -109,7 +124,6 @@ final class OrderedClassElements protected static $protStatProp; const C1 = 1; - const C2 = 2; public static $pubStatProp1; @@ -184,7 +198,6 @@ public function func() {} class SingleClassElementPerStatement { const FOO_1 = 1; - const FOO_2 = 2; private static $bar1 = [1, 2, 3]; diff --git a/tests/Fixtures/Ruleset/relaxplus_expected.php b/tests/Fixtures/Ruleset/relaxplus_expected.php index addc3a9..09b7a7e 100644 --- a/tests/Fixtures/Ruleset/relaxplus_expected.php +++ b/tests/Fixtures/Ruleset/relaxplus_expected.php @@ -83,7 +83,6 @@ final class OrderedClassElements use TraiB; const C1 = 1; - const C2 = 2; protected static $protStatProp;