Skip to content

Commit 86bce23

Browse files
committed
Do not require space before control structures
1 parent 9578c54 commit 86bce23

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

lib/Doctrine/ruleset.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@
206206
<!-- Forbid assignments in conditions -->
207207
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
208208
<!-- Require consistent spacing for block structures -->
209-
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing"/>
209+
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
210+
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure" />
211+
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure" />
212+
</rule>
210213
<!-- Forbid fancy yoda conditions -->
211214
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
212215
<!-- Require usage of early exit -->

tests/expected_report.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tests/input/constants-var.php 4 0
1212
tests/input/doc-comment-spacing.php 10 0
1313
tests/input/duplicate-assignment-variable.php 1 0
1414
tests/input/EarlyReturn.php 6 0
15-
tests/input/example-class.php 48 0
15+
tests/input/example-class.php 45 0
1616
tests/input/forbidden-comments.php 8 0
1717
tests/input/forbidden-functions.php 6 0
1818
tests/input/inline_type_hint_assertions.php 7 0
@@ -38,9 +38,9 @@ tests/input/use-ordering.php 1 0
3838
tests/input/useless-semicolon.php 2 0
3939
tests/input/UselessConditions.php 20 0
4040
----------------------------------------------------------------------
41-
A TOTAL OF 293 ERRORS AND 0 WARNINGS WERE FOUND IN 34 FILES
41+
A TOTAL OF 290 ERRORS AND 0 WARNINGS WERE FOUND IN 34 FILES
4242
----------------------------------------------------------------------
43-
PHPCBF CAN FIX 232 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
43+
PHPCBF CAN FIX 229 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
4444
----------------------------------------------------------------------
4545

4646

tests/fixed/example-class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public function throwWhenInvalid() : void
127127
public function trySwitchSpace() : void
128128
{
129129
try {
130+
$var = 1;
130131
switch (self::VERSION) {
131132
default:
132133
}

tests/input/example-class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public function throwWhenInvalid() : void
122122
public function trySwitchSpace() : void
123123
{
124124
try {
125+
$var = 1;
125126
switch (self::VERSION) {
126127
default:
127128
}

0 commit comments

Comments
 (0)