Browse Source

BlankLineBeforeControlStatementFixer - rename to BlankLineBeforeStatementFixer, update the fixer

SpacePossum 7 years ago
parent
commit
a5036e09f3

+ 1 - 0
.php_cs.dist

@@ -17,6 +17,7 @@ return PhpCsFixer\Config::create()
         '@Symfony' => true,
         '@Symfony:risky' => true,
         'array_syntax' => ['syntax' => 'short'],
+        'blank_line_before_statement' => true,
         'combine_consecutive_unsets' => true,
         // one should use PHPUnit methods to set up expected exception instead of annotations
         'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],

+ 9 - 8
README.rst

@@ -236,19 +236,20 @@ Choose from the list of available rules:
   Ensure there is no code on the same line as the PHP open tag and it is
   followed by a blank line.
 
-* **blank_line_before_control_statement** [@Symfony]
+* **blank_line_before_return**
 
-  An empty line feed should precede a control statement.
+  An empty line feed should precede a return statement (deprecated, use
+  ``blank_line_before_statement`` instead).
 
-  Configuration options:
+* **blank_line_before_statement** [@Symfony]
 
-  - ``statements`` (``array``): list of control statements to fix; defaults to
-    ``['return']``
+  An empty line feed must precede any configured statement.
 
-* **blank_line_before_return**
+  Configuration options:
 
-  An empty line feed should precede a return statement (deprecated, use
-  ``blank_line_before_control_statement`` instead).
+  - ``statements`` (``array``): list of statements which must be must be preceded by
+    an empty line; defaults to ``['break', 'continue', 'declare', 'return',
+    'throw', 'try']``
 
 * **braces** [@PSR2, @Symfony]
 

+ 1 - 0
src/AbstractFunctionReferenceFixer.php

@@ -128,6 +128,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
 
             if (null !== $blockDefinitionProbe && true === $blockDefinitionProbe['isStart']) {
                 $paramContentIndex = $tokens->findBlockEnd($blockDefinitionProbe['type'], $paramContentIndex);
+
                 continue;
             }
 

+ 1 - 0
src/Console/Command/DescribeCommand.php

@@ -92,6 +92,7 @@ final class DescribeCommand extends Command
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         $name = $input->getArgument('name');
+
         try {
             if ('@' === $name[0]) {
                 $this->describeSet($output, $name);

+ 1 - 0
src/Fixer/Alias/NoMixedEchoPrintFixer.php

@@ -134,6 +134,7 @@ final class NoMixedEchoPrintFixer extends AbstractFixer implements Configuration
 
             if ($tokens[$i]->equals(',')) {
                 $canBeConverted = false;
+
                 break;
             }
         }

+ 4 - 0
src/Fixer/Basic/BracesFixer.php

@@ -343,6 +343,7 @@ class Foo
 
                 if ($nestToken->equals(')')) {
                     $nestIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $nestIndex, false);
+
                     continue;
                 }
 
@@ -399,11 +400,13 @@ class Foo
 
                 if ($nestToken->equals('}')) {
                     ++$nestLevel;
+
                     continue;
                 }
 
                 if ($nestToken->equals('{')) {
                     --$nestLevel;
+
                     continue;
                 }
             }
@@ -641,6 +644,7 @@ class Foo
             // if there is some block in statement (eg lambda function) we need to skip it
             if ($token->equals('{')) {
                 $index = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $index);
+
                 continue;
             }
 

+ 1 - 0
src/Fixer/Casing/NativeFunctionCasingFixer.php

@@ -62,6 +62,7 @@ final class NativeFunctionCasingFixer extends AbstractFixer
             $next = $tokens->getNextMeaningfulToken($index);
             if (!$tokens[$next]->equals('(')) {
                 $index = $next;
+
                 continue;
             }
 

+ 1 - 0
src/Fixer/CastNotation/NoShortBoolCastFixer.php

@@ -74,6 +74,7 @@ final class NoShortBoolCastFixer extends AbstractFixer
         for ($i = $index - 1; $i > 1; --$i) {
             if ($tokens[$i]->equals('!')) {
                 $this->fixShortCastToBoolCast($tokens, $i, $index);
+
                 break;
             }
 

+ 1 - 0
src/Fixer/ClassNotation/MethodSeparationFixer.php

@@ -316,6 +316,7 @@ final class Sample
         for ($i = $commentIndex - 1; $i > 0; --$i) {
             if ($tokens[$i]->isComment()) {
                 $start = $i;
+
                 continue;
             }
 

+ 6 - 0
src/Fixer/ClassNotation/OrderedClassElementsFixer.php

@@ -93,12 +93,14 @@ final class OrderedClassElementsFixer extends AbstractFixer implements Configura
 
             if (!$parents) {
                 $this->typePosition[$type] = null;
+
                 continue;
             }
 
             foreach ($parents as $parent) {
                 if (isset($this->typePosition[$parent])) {
                     $this->typePosition[$type] = $this->typePosition[$parent];
+
                     continue 2;
                 }
             }
@@ -268,11 +270,13 @@ final class Example
 
                 if ($token->isGivenKind(T_STATIC)) {
                     $element['static'] = true;
+
                     continue;
                 }
 
                 if ($token->isGivenKind([T_PROTECTED, T_PRIVATE])) {
                     $element['visibility'] = strtolower($token->getContent());
+
                     continue;
                 }
 
@@ -289,6 +293,7 @@ final class Example
                 }
 
                 $element['end'] = $this->findElementEnd($tokens, $i);
+
                 break;
             }
 
@@ -391,6 +396,7 @@ final class Example
                     if ('phpunit' === $type) {
                         $element['position'] += $phpunitPositions[$element['name']];
                     }
+
                     continue;
                 }
 

Some files were not shown because too many files changed in this diff