Skip to content

Commit d33f69e

Browse files
authored
Merge pull request #120 from doctrine/newline-return
Require newline before return
2 parents 2baaf29 + fe9849c commit d33f69e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lib/Doctrine/ruleset.xml

+8
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@
202202
<rule ref="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>
203203
<!-- Forbid assignments in conditions -->
204204
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
205+
<!-- Require consistent spacing for control structures -->
206+
<rule ref="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing">
207+
<properties>
208+
<property name="tokensToCheck" type="array">
209+
<element value="T_RETURN" />
210+
</property>
211+
</properties>
212+
</rule>
205213
<!-- Forbid fancy yoda conditions -->
206214
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
207215
<!-- Require usage of early exit -->

tests/expected_report.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tests/input/constants-var.php 3 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 32 0
15+
tests/input/example-class.php 33 0
1616
tests/input/forbidden-comments.php 8 0
1717
tests/input/forbidden-functions.php 6 0
1818
tests/input/LowCaseTypes.php 2 0
@@ -34,9 +34,9 @@ tests/input/UnusedVariables.php 1 0
3434
tests/input/useless-semicolon.php 2 0
3535
tests/input/UselessConditions.php 20 0
3636
----------------------------------------------------------------------
37-
A TOTAL OF 257 ERRORS AND 0 WARNINGS WERE FOUND IN 30 FILES
37+
A TOTAL OF 258 ERRORS AND 0 WARNINGS WERE FOUND IN 30 FILES
3838
----------------------------------------------------------------------
39-
PHPCBF CAN FIX 209 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
39+
PHPCBF CAN FIX 210 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
4040
----------------------------------------------------------------------
4141

4242

tests/fixed/example-class.php

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function getFoo() : ?int
5757
public function getIterator() : array
5858
{
5959
assert($this->bar !== null);
60+
6061
return new ArrayIterator($this->bar);
6162
}
6263

0 commit comments

Comments
 (0)