Skip to content

Commit

Permalink
Merge pull request #95 from doctrine/multiple-lines-between-functions
Browse files Browse the repository at this point in the history
Add sniff to forbid multiple lines between functions
  • Loading branch information
lcobucci committed Nov 30, 2018
2 parents 0247a0d + c35076b commit 4f5b25d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions lib/Doctrine/ruleset.xml
Expand Up @@ -444,6 +444,14 @@
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<!-- Forbid blank line after function opening brace -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!-- Require 1 line before and after function, except at the top and bottom -->
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
<property name="spacingBeforeFirst" value="0"/>
<property name="spacingAfterLast" value="0"/>
</properties>
</rule>
<!-- Require space after language constructs -->
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<!-- Require space around logical operators -->
Expand Down
8 changes: 4 additions & 4 deletions tests/expected_report.txt
Expand Up @@ -10,7 +10,7 @@ tests/input/concatenation_spacing.php 24 0
tests/input/constants-var.php 3 0
tests/input/doc-comment-spacing.php 10 0
tests/input/EarlyReturn.php 5 0
tests/input/example-class.php 28 0
tests/input/example-class.php 32 0
tests/input/forbidden-comments.php 4 0
tests/input/forbidden-functions.php 6 0
tests/input/LowCaseTypes.php 2 0
Expand All @@ -24,13 +24,13 @@ tests/input/return_type_on_methods.php 17 0
tests/input/semicolon_spacing.php 3 0
tests/input/static-closures.php 1 0
tests/input/test-case.php 8 0
tests/input/traits-uses.php 10 0
tests/input/traits-uses.php 11 0
tests/input/UnusedVariables.php 1 0
tests/input/useless-semicolon.php 2 0
----------------------------------------------------------------------
A TOTAL OF 205 ERRORS AND 0 WARNINGS WERE FOUND IN 24 FILES
A TOTAL OF 210 ERRORS AND 0 WARNINGS WERE FOUND IN 24 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 175 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 180 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


2 changes: 2 additions & 0 deletions tests/input/example-class.php
Expand Up @@ -47,6 +47,7 @@ public function getFoo(): ? int
return $this->foo;
}


/**
* @return iterable
*/
Expand Down Expand Up @@ -83,4 +84,5 @@ public static function getTestCase() : TestCase
{
return new TestCase();
}

}

0 comments on commit 4f5b25d

Please sign in to comment.