Browse Source

Fix uchars

SpacePossum 8 years ago
parent
commit
a52b9dedb5
2 changed files with 45 additions and 2 deletions
  1. 2 2
      src/Fixer/Phpdoc/PhpdocAlignFixer.php
  2. 43 0
      tests/Fixer/Phpdoc/PhpdocAlignFixerTest.php

+ 2 - 2
src/Fixer/Phpdoc/PhpdocAlignFixer.php

@@ -41,8 +41,8 @@ final class PhpdocAlignFixer extends AbstractFixer implements WhitespacesAwareFi
         // optional <desc>
         $desc = '(?:\s+(?P<desc>\V*))';
 
-        $this->regex = '/^'.$indent.' \* @(?:'.$paramTag.'|'.$otherTags.')'.$desc.'\s*$/';
-        $this->regexCommentLine = '/^'.$indent.' \*(?! @)(?:\s+(?P<desc>\V+))(?<!\*\/)$/';
+        $this->regex = '/^'.$indent.' \* @(?:'.$paramTag.'|'.$otherTags.')'.$desc.'\s*$/u';
+        $this->regexCommentLine = '/^'.$indent.' \*(?! @)(?:\s+(?P<desc>\V+))(?<!\*\/)$/u';
     }
 
     /**

+ 43 - 0
tests/Fixer/Phpdoc/PhpdocAlignFixerTest.php

@@ -469,4 +469,47 @@ EOF;
             ),
         );
     }
+
+    public function testFixUnicode()
+    {
+        $expected = <<<'EOF'
+<?php
+    /**
+     * Method test.
+     *
+     * @param int      $foobar Description
+     * @param string   $foo    Description
+     * @param mixed    $bar    Description word_with_ą
+     * @param int|null $test   Description
+     */
+    $a = 1;
+
+    /**
+     * @return string
+     * @SuppressWarnings(PHPMD.UnusedLocalVariable) word_with_ą
+     */
+    $b = 1;
+EOF;
+
+        $input = <<<'EOF'
+<?php
+    /**
+     * Method test.
+     *
+     * @param int    $foobar Description
+     * @param string $foo    Description
+     * @param mixed $bar Description word_with_ą
+     * @param int|null $test Description
+     */
+    $a = 1;
+
+    /**
+     * @return string
+     *   @SuppressWarnings(PHPMD.UnusedLocalVariable) word_with_ą
+     */
+    $b = 1;
+EOF;
+
+        $this->doTest($expected, $input);
+    }
 }