Removes extra blank lines and/or blank lines following configuration.
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']
Default configuration.
--- Original
+++ New
@@ -2,5 +2,4 @@
$foo = array("foo");
-
$bar = "bar";
With configuration: ['tokens' => ['break']]
.
--- Original
+++ New
@@ -4,7 +4,6 @@
case 41:
echo "foo";
break;
-
case 42:
break;
}
With configuration: ['tokens' => ['continue']]
.
--- Original
+++ New
@@ -3,6 +3,5 @@
for ($i = 0; $i < 9000; ++$i) {
if (true) {
continue;
-
}
}
With configuration: ['tokens' => ['curly_brace_block']]
.
--- Original
+++ New
@@ -1,7 +1,5 @@
<?php
for ($i = 0; $i < 9000; ++$i) {
-
echo $i;
-
}
With configuration: ['tokens' => ['extra']]
.
--- Original
+++ New
@@ -2,5 +2,4 @@
$foo = array("foo");
-
$bar = "bar";
With configuration: ['tokens' => ['parenthesis_brace_block']]
.
--- Original
+++ New
@@ -1,7 +1,5 @@
<?php
$foo = array(
-
"foo"
-
);
With configuration: ['tokens' => ['return']]
.
--- Original
+++ New
@@ -3,5 +3,4 @@
function foo($bar)
{
return $bar;
-
}
With configuration: ['tokens' => ['square_brace_block']]
.
--- Original
+++ New
@@ -1,7 +1,5 @@
<?php
$foo = [
-
"foo"
-
];
With configuration: ['tokens' => ['throw']]
.
--- Original
+++ New
@@ -3,5 +3,4 @@
function foo($bar)
{
throw new \Exception("Hello!");
-
}
With configuration: ['tokens' => ['use']]
.
--- Original
+++ New
@@ -3,9 +3,8 @@
namespace Foo;
use Bar\Baz;
-
use Baz\Bar;
class Bar
{
}
With configuration: ['tokens' => ['use_trait']]
.
--- Original
+++ New
@@ -3,6 +3,5 @@
class Foo
{
use Bar;
-
use Baz;
}
With configuration: ['tokens' => ['switch', 'case', 'default']]
.
--- Original
+++ New
@@ -1,9 +1,6 @@
<?php
switch($a) {
-
case 1:
-
default:
-
echo 3;
}
The rule is part of the following rule sets:
- @PhpCsFixer
Using the @PhpCsFixer rule set will enable the
no_extra_blank_lines
rule with the config below:['tokens' => ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']]
- @Symfony
Using the @Symfony rule set will enable the
no_extra_blank_lines
rule with the config below:['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']]