Browse Source

PhpdocIndentFixer - fix edge case with inline phpdoc

Dariusz Ruminski 7 years ago
parent
commit
101dc437f6

+ 1 - 1
src/Fixer/Phpdoc/PhpdocIndentFixer.php

@@ -92,7 +92,7 @@ class DocBlocks
             if (
                 $prevToken->isGivenKind(T_OPEN_TAG)
                 || ($prevToken->isWhitespace(" \t") && !$tokens[$index - 2]->isGivenKind(T_OPEN_TAG))
-                || $prevToken->equalsAny(array(';', '{'))
+                || $prevToken->equalsAny(array(';', ',', '{', '('))
             ) {
                 continue;
             }

+ 9 - 0
tests/Fixer/Phpdoc/PhpdocIndentFixerTest.php

@@ -381,6 +381,15 @@ $foo = $bar;
 ',
         );
 
+        $cases[] = array(
+            '<?php
+function foo()
+{
+    $foo->bar(/** oops */$baz);
+    $foo->bar($a,/** oops */$baz);
+}',
+        );
+
         return $cases;
     }
 }