Fork me on GitHub
a Sensio Labs Product

Remote Void (v2.18.5) edition

Rule no_extra_consecutive_blank_lines

Warning

This rule is deprecated and will be removed on next major version.

You should use no_extra_blank_lines instead.

Removes extra blank lines and/or blank lines following configuration.

Configuration

tokens

List of tokens to fix.

Allowed values: a subset of ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', 'useTrait', 'use_trait']

Default value: ['extra']

Examples

Example #1

Default configuration.

--- Original
+++ New
 <?php

 $foo = array("foo");

-
 $bar = "bar";

Example #2

With configuration: ['tokens' => ['break']].

--- Original
+++ New
 <?php

 switch ($foo) {
     case 41:
         echo "foo";
         break;
-
     case 42:
         break;
 }

Example #3

With configuration: ['tokens' => ['continue']].

--- Original
+++ New
 <?php

 for ($i = 0; $i < 9000; ++$i) {
     if (true) {
         continue;
-
     }
 }

Example #4

With configuration: ['tokens' => ['curly_brace_block']].

--- Original
+++ New
 <?php

 for ($i = 0; $i < 9000; ++$i) {
-
     echo $i;
-
 }

Example #5

With configuration: ['tokens' => ['extra']].

--- Original
+++ New
 <?php

 $foo = array("foo");

-
 $bar = "bar";

Example #6

With configuration: ['tokens' => ['parenthesis_brace_block']].

--- Original
+++ New
 <?php

 $foo = array(
-
     "foo"
-
 );

Example #7

With configuration: ['tokens' => ['return']].

--- Original
+++ New
 <?php

 function foo($bar)
 {
     return $bar;
-
 }

Example #8

With configuration: ['tokens' => ['square_brace_block']].

--- Original
+++ New
 <?php

 $foo = [
-
     "foo"
-
 ];

Example #9

With configuration: ['tokens' => ['throw']].

--- Original
+++ New
 <?php

 function foo($bar)
 {
     throw new \Exception("Hello!");
-
 }

Example #10

With configuration: ['tokens' => ['use']].

--- Original
+++ New
 <?php

 namespace Foo;

 use Bar\Baz;
-
 use Baz\Bar;

 class Bar
 {
 }

Example #11

With configuration: ['tokens' => ['use_trait']].

--- Original
+++ New
 <?php

 class Foo
 {
     use Bar;
-
     use Baz;
 }

Example #12

With configuration: ['tokens' => ['switch', 'case', 'default']].

--- Original
+++ New
 <?php
 switch($a) {
-
     case 1:
-
     default:
-
         echo 3;
 }
The logo is © 2010-2014 Sensio Labs