Просмотр исходного кода

SingleSpaceAfterConstructFixer - do not touch multi line implements

SpacePossum 4 лет назад
Родитель
Сommit
ed8a22841f

+ 2 - 2
src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php

@@ -218,7 +218,7 @@ yield  from  baz();
                 continue;
                 continue;
             }
             }
 
 
-            if ($token->isGivenKind(T_EXTENDS) && $this->isMultilineExtendsWithMoreThanOneAncestor($tokens, $index)) {
+            if ($token->isGivenKind([T_EXTENDS, T_IMPLEMENTS]) && $this->isMultilineExtendsOrImplementsWithMoreThanOneAncestor($tokens, $index)) {
                 continue;
                 continue;
             }
             }
 
 
@@ -298,7 +298,7 @@ yield  from  baz();
      *
      *
      * @return bool
      * @return bool
      */
      */
-    private function isMultilineExtendsWithMoreThanOneAncestor(Tokens $tokens, $index)
+    private function isMultilineExtendsOrImplementsWithMoreThanOneAncestor(Tokens $tokens, $index)
     {
     {
         $hasMoreThanOneAncestor = false;
         $hasMoreThanOneAncestor = false;
 
 

+ 7 - 0
tests/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixerTest.php

@@ -1544,6 +1544,13 @@ foo; foo: echo "Bar";',
                 '<?php class Foo implements /* foo */\Countable {}',
                 '<?php class Foo implements /* foo */\Countable {}',
                 '<?php class Foo implements  /* foo */\Countable {}',
                 '<?php class Foo implements  /* foo */\Countable {}',
             ],
             ],
+            [
+                '<?php class Foo implements
+                    \Countable,
+                    Bar,
+                    Baz
+                {}',
+            ],
         ];
         ];
     }
     }