Browse Source

Merge branch '2.10'

Dariusz Ruminski 7 years ago
parent
commit
60b8d46d4a

+ 2 - 1
src/Fixer/Comment/CommentToPhpdocFixer.php

@@ -16,6 +16,7 @@ use PhpCsFixer\AbstractFixer;
 use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
 use PhpCsFixer\FixerDefinition\CodeSample;
 use PhpCsFixer\FixerDefinition\FixerDefinition;
+use PhpCsFixer\Preg;
 use PhpCsFixer\Tokenizer\Analyzer\CommentsAnalyzer;
 use PhpCsFixer\Tokenizer\Token;
 use PhpCsFixer\Tokenizer\Tokens;
@@ -99,7 +100,7 @@ final class CommentToPhpdocFixer extends AbstractFixer implements WhitespacesAwa
         return array_reduce(
             $indices,
             function ($carry, $index) use ($tokens) {
-                return $carry || 1 === preg_match('~(#|//|/\*+|\R(\s*\*)?)\s*\@[a-zA-Z0-9_\\\\-]+(?=\s|\(|$)~', $tokens[$index]->getContent());
+                return $carry || 1 === Preg::match('~(#|//|/\*+|\R(\s*\*)?)\s*\@[a-zA-Z0-9_\\\\-]+(?=\s|\(|$)~', $tokens[$index]->getContent());
             },
             false
         );

+ 2 - 1
src/Tokenizer/Analyzer/CommentsAnalyzer.php

@@ -12,6 +12,7 @@
 
 namespace PhpCsFixer\Tokenizer\Analyzer;
 
+use PhpCsFixer\Preg;
 use PhpCsFixer\Tokenizer\Tokens;
 
 /**
@@ -98,7 +99,7 @@ final class CommentsAnalyzer
     {
         $lineCount = 0;
         for ($i = $whiteStart; $i < $whiteEnd; ++$i) {
-            $lineCount += preg_match_all('/\R/u', $tokens[$i]->getContent());
+            $lineCount += Preg::matchAll('/\R/u', $tokens[$i]->getContent());
         }
 
         return $lineCount;

+ 1 - 0
tests/AutoReview/FixerFactoryTest.php

@@ -360,6 +360,7 @@ final class FixerFactoryTest extends TestCase
 
         if (in_array($fileName, [
             'combine_consecutive_issets,no_singleline_whitespace_before_semicolons.test',
+            'comment_to_phpdoc,phpdoc_to_comment.test',
         ], true)) {
             $this->markTestIncomplete(sprintf('Case "%s" is not fully handled, please help fixing it.', $fileName));
         }

+ 4 - 2
tests/Fixer/Alias/NoMixedEchoPrintFixerTest.php

@@ -55,8 +55,10 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
                 print("test");
                 ',
             ],
-            // `echo` can take multiple parameters (although such usage is rare) while `print` can take only one argument,
-            // @see https://php.net/manual/en/function.echo.php and @see https://php.net/manual/en/function.print.php
+            /*
+             * `echo` can take multiple parameters (although such usage is rare) while `print` can take only one argument,
+             * @see https://php.net/manual/en/function.echo.php and @see https://php.net/manual/en/function.print.php
+             */
             [
                 '<?php
                 echo "This ", "string ", "was ", "made ", "with multiple parameters.";