From d9a8b87a6e74baa237b12cb7e3438d32198ad6d8 Mon Sep 17 00:00:00 2001 From: Kei Date: Thu, 1 Aug 2024 02:09:06 +0700 Subject: [PATCH] relax: Add `no_break_comment` --- src/RuleSet/Sets/Relax.php | 1 + tests/Fixtures/Ruleset/relax_actual.php | 14 ++++++++++++++ tests/Fixtures/Ruleset/relax_expected.php | 14 ++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/RuleSet/Sets/Relax.php b/src/RuleSet/Sets/Relax.php index 7b0a67a..509d3f6 100644 --- a/src/RuleSet/Sets/Relax.php +++ b/src/RuleSet/Sets/Relax.php @@ -29,6 +29,7 @@ public function mainRules(): array 'attribute_empty_parentheses' => true, 'class_reference_name_casing' => true, 'combine_consecutive_unsets' => true, + 'no_break_comment' => true, 'no_unneeded_import_alias' => true, 'no_useless_concat_operator' => true, 'no_useless_else' => true, diff --git a/tests/Fixtures/Ruleset/relax_actual.php b/tests/Fixtures/Ruleset/relax_actual.php index 56886dc..911eb54 100644 --- a/tests/Fixtures/Ruleset/relax_actual.php +++ b/tests/Fixtures/Ruleset/relax_actual.php @@ -179,6 +179,20 @@ public function comment__single_line_comment_style() */ } + public function control_structure__no_break_comment() + { + switch (true) { + case 1: + foo(); + case 2: + bar(); + // no break + break; + case 3: + baz(); + } + } + public function control_structure__control_structure_braces() { if (foo()) echo 'Hello!'; diff --git a/tests/Fixtures/Ruleset/relax_expected.php b/tests/Fixtures/Ruleset/relax_expected.php index 4316aae..ac5ecf4 100644 --- a/tests/Fixtures/Ruleset/relax_expected.php +++ b/tests/Fixtures/Ruleset/relax_expected.php @@ -179,6 +179,20 @@ public function comment__single_line_comment_style() */ } + public function control_structure__no_break_comment() + { + switch (true) { + case 1: + foo(); + // no break + case 2: + bar(); + break; + case 3: + baz(); + } + } + public function control_structure__control_structure_braces() { if (foo()) {