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

Merge branch 'master' into 3.0

# Conflicts:
#	composer.json
#	src/Console/Application.php
#	src/Runner/Runner.php
#	tests/AutoReview/FixerFactoryTest.php
#	tests/FixerConfiguration/FixerConfigurationResolverRootlessTest.php
#	tests/Test/AbstractFixerTestCase.php
#	tests/Test/AbstractIntegrationTestCase.php
#	tests/Tokenizer/TokenTest.php
Dariusz Ruminski 7 лет назад
Родитель
Сommit
88dc9b37c1

+ 4 - 0
.composer-require-checker.json

@@ -3,6 +3,10 @@
         "HHVM_VERSION_ID",
         "HHVM_VERSION_ID",
         "PHPUnit\\Framework\\TestCase", "Prophecy\\Argument",
         "PHPUnit\\Framework\\TestCase", "Prophecy\\Argument",
         "GeckoPackages\\PHPUnit\\Constraints\\SameStringsConstraint",
         "GeckoPackages\\PHPUnit\\Constraints\\SameStringsConstraint",
+        "PHPUnitGoodPractices\\Traits\\ExpectationViaCodeOverAnnotationTrait",
+        "PHPUnitGoodPractices\\Traits\\ExpectOverSetExceptionTrait",
+        "PHPUnitGoodPractices\\Traits\\IdentityOverEqualityTrait",
+        "PHPUnitGoodPractices\\Traits\\ProphecyOverMockObjectTrait",
 
 
         "null", "true", "false",
         "null", "true", "false",
         "static", "self", "parent",
         "static", "self", "parent",

+ 1 - 0
.php_cs.dist

@@ -32,6 +32,7 @@ $config = PhpCsFixer\Config::create()
         'list_syntax' => ['syntax' => 'long'],
         'list_syntax' => ['syntax' => 'long'],
         'method_chaining_indentation' => true,
         'method_chaining_indentation' => true,
         'method_argument_space' => ['ensure_fully_multiline' => true],
         'method_argument_space' => ['ensure_fully_multiline' => true],
+        'multiline_comment_opening_closing' => true,
         'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
         'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
         'no_null_property_initialization' => true,
         'no_null_property_initialization' => true,
         'no_short_echo_tag' => true,
         'no_short_echo_tag' => true,

+ 2 - 5
.travis.yml

@@ -38,7 +38,7 @@ jobs:
                 - export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
                 - export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
             script:
             script:
                 # @TODO remove at 3.0
                 # @TODO remove at 3.0
-                - git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php | grep -v tests/Test/Assert/AssertTokensTrait.php | grep -v tests/Test/AbstractFixerTestCase.php | grep -v tests/Test/AbstractIntegrationTestCase.php | grep -v tests/Test/IntegrationCase.php | grep -v tests/Test/IntegrationCaseFactory.php && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
+                - git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php | grep -v tests/TestCase.php | grep -v tests/Test/Assert/AssertTokensTrait.php | grep -v tests/Test/AbstractFixerTestCase.php | grep -v tests/Test/AbstractIntegrationTestCase.php | grep -v tests/Test/IntegrationCase.php | grep -v tests/Test/IntegrationCaseFactory.php && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
 
 
                 - ./check_trailing_spaces.sh || travis_terminate 1
                 - ./check_trailing_spaces.sh || travis_terminate 1
                 - if [ -n "$COMMIT_SCA_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$COMMIT_SCA_FILES" | grep -Ev "^(src/Resources|tests/Fixtures)" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
                 - if [ -n "$COMMIT_SCA_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$COMMIT_SCA_FILES" | grep -Ev "^(src/Resources|tests/Fixtures)" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
@@ -104,10 +104,7 @@ jobs:
             php: 7.1
             php: 7.1
             install: ./dev-tools/build.sh
             install: ./dev-tools/build.sh
             script:
             script:
-                - php php-cs-fixer.phar --version
-                - php php-cs-fixer.phar readme
-                - php php-cs-fixer.phar describe header_comment
-                - php php-cs-fixer.phar fix src/Config.php -vvv --dry-run --diff
+                - vendor/bin/phpunit tests/Smoke/PharTest.php
             deploy:
             deploy:
                 provider: releases
                 provider: releases
                 api_key:
                 api_key:

+ 86 - 0
CHANGELOG.md

@@ -3,6 +3,65 @@ CHANGELOG for PHP CS Fixer
 
 
 This file contains changelogs for stable releases only.
 This file contains changelogs for stable releases only.
 
 
+Changelog for v2.10.0
+---------------------
+
+* feature #3290 Add PhpdocOpeningClosingFixer (Slamdunk, keradus)
+* feature #3327 Add MultilineWhitespaceBeforeSemicolonsFixer (egircys, keradus)
+* feature #3351 PhuUnit: migrate getMock to createPartialMock when arguments count is 2 (Slamdunk)
+* feature #3362 Add BacktickToShellExecFixer (Slamdunk)
+* minor #3285 PHPUnit - use protective traits (keradus)
+* minor #3329 ConfigurationResolver - detect deprecated fixers (keradus, SpacePossum)
+* minor #3343 Tokens - improve block end lookup (keradus)
+* minor #3360 Adjust Symfony ruleset (keradus)
+* minor #3361 no_extra_consecutive_blank_lines - rename to no_extra_blank_lines (with BC layer) (keradus)
+* minor #3363 progress-type - name main option value 'dots' (keradus)
+* minor #3404 Deprecate "use_yoda_style" in IsNullFixer (kubawerlos, keradus)
+* minor #3418 ConfigurableFixerInterface, ConfigurationDefinitionFixerInterface - update deprecations (keradus)
+* minor #3419 Dont use deprecated fixer in itest (keradus)
+
+Changelog for v2.9.1
+--------------------
+
+* bug #3298 DiffConsoleFormatter - fix output escaping. (SpacePossum)
+* bug #3312 PhpUnitTestAnnotationFixer: Only remove prefix if it really is a prefix (localheinz)
+* bug #3318 SingleLineCommentStyleFixer - fix closing tag inside comment causes an error (kubawerlos)
+* bug #3334 ExplicitStringVariableFixer: handle parsed array and object (Slamdunk)
+* bug #3337 BracesFixer: nowdoc bug on template files (Slamdunk)
+* bug #3349 Fix stdin handling and add tests for it (keradus)
+* bug #3350 PhpUnitNoExpectationAnnotationFixer - fix handling of multiline expectedExceptionMessage annotation (Slamdunk)
+* bug #3352 FunctionToConstantFixer - bugfix for get_class with leading backslash (kubawerlos)
+* bug #3359 BracesFixer - handle comment for content outside of given block (keradus)
+* bug #3371 IsNullFixer must be run before YodaStyleFixer (kubawerlos)
+* bug #3373 PhpdocAlignFixer - Fix removing of everything after @ when there is a space after the @ (ntzm)
+* bug #3415 FileFilterIterator - input checks and utests (SpacePossum, keradus)
+* bug #3420 SingleLineCommentStyleFixer - fix 'strpos() expects parameter 1 to be string, boolean given' (keradus, SpacePossum)
+* bug #3428 Fix archive analysing (keradus)
+* bug #3429 Fix archive analysing (keradus)
+* minor #3137 PHPUnit - use common base class (keradus)
+* minor #3311 FinalInternalClassFixer - fix typo (localheinz)
+* minor #3328 Remove duplicated space in exceptions (keradus)
+* minor #3342 PhpUnitDedicateAssertFixer - Remove unexistent method is_boolean  (carusogabriel)
+* minor #3345 StdinFileInfo - fix __toString (keradus)
+* minor #3346 StdinFileInfo - drop getContents (keradus)
+* minor #3347 DX: reapply newest CS (keradus)
+* minor #3365 COOKBOOK-FIXERS.md - update to provide definition instead of description (keradus)
+* minor #3370 AbstractFixer - FQCN in in exceptions (Slamdunk)
+* minor #3372 ProjectCodeTest - fix comment (keradus)
+* minor #3393 Method call typos (Slamdunk, keradus)
+* minor #3402 Always provide delimiter to `preg_quote` calls (ntzm)
+* minor #3403 Remove unused import (ntzm)
+* minor #3405 Fix `fopen` mode (ntzm)
+* minor #3407 CombineConsecutiveIssetsFixer - Improve description (kubawerlos)
+* minor #3408 Improving fixers descriptions (kubawerlos)
+* minor #3409 move itests from misc to priority (keradus)
+* minor #3411 Better type hinting for AbstractFixerTestCase::$fixer (kubawerlos)
+* minor #3412 Convert `strtolower` inside `strpos` to just `stripos` (ntzm)
+* minor #3421 DX: Use ::class (keradus)
+* minor #3424 AbstractFixerTest: fix expectException arguments (Slamdunk, keradus)
+* minor #3425 FixerFactoryTest - test that priority pair fixers have itest (keradus, SpacePossum)
+* minor #3427 ConfigurationResolver: fix @return annotation (Slamdunk)
+
 Changelog for v2.9.0
 Changelog for v2.9.0
 --------------------
 --------------------
 
 
@@ -433,6 +492,33 @@ Changelog for v2.3.0
 * minor #2568 Require PHP 5.6+ (keradus)
 * minor #2568 Require PHP 5.6+ (keradus)
 * minor #2672 Bump symfony/* deps (keradus)
 * minor #2672 Bump symfony/* deps (keradus)
 
 
+Changelog for v2.2.14
+---------------------
+
+* bug #3298 DiffConsoleFormatter - fix output escaping. (SpacePossum)
+* bug #3337 BracesFixer: nowdoc bug on template files (Slamdunk)
+* bug #3349 Fix stdin handling and add tests for it (keradus)
+* bug #3359 BracesFixer - handle comment for content outside of given block (keradus)
+* bug #3415 FileFilterIterator - input checks and utests (SpacePossum, keradus)
+* bug #3429 Fix archive analysing (keradus)
+* minor #3137 PHPUnit - use common base class (keradus)
+* minor #3342 PhpUnitDedicateAssertFixer - Remove unexistent method is_boolean  (carusogabriel)
+* minor #3345 StdinFileInfo - fix `__toString` (keradus)
+* minor #3346 StdinFileInfo - drop getContents (keradus)
+* minor #3347 DX: reapply newest CS (keradus)
+* minor #3365 COOKBOOK-FIXERS.md - update to provide definition instead of description (keradus)
+* minor #3370 AbstractFixer - FQCN in in exceptions (Slamdunk)
+* minor #3372 ProjectCodeTest - fix comment (keradus)
+* minor #3402 Always provide delimiter to `preg_quote` calls (ntzm)
+* minor #3403 Remove unused import (ntzm)
+* minor #3405 Fix `fopen` mode (ntzm)
+* minor #3408 Improving fixers descriptions (kubawerlos)
+* minor #3409 move itests from misc to priority (keradus)
+* minor #3411 Better type hinting for AbstractFixerTestCase::$fixer (kubawerlos)
+* minor #3412 Convert `strtolower` inside `strpos` to just `stripos` (ntzm)
+* minor #3425 FixerFactoryTest - test that priority pair fixers have itest (keradus, SpacePossum)
+* minor #3427 ConfigurationResolver: fix @return annotation (Slamdunk)
+
 Changelog for v2.2.13
 Changelog for v2.2.13
 ---------------------
 ---------------------
 
 

+ 24 - 9
README.rst

@@ -46,7 +46,7 @@ or with specified version:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.9.0/php-cs-fixer.phar -O php-cs-fixer
+    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.10.0/php-cs-fixer.phar -O php-cs-fixer
 
 
 or with curl:
 or with curl:
 
 
@@ -257,6 +257,10 @@ Choose from the list of available rules:
   - ``syntax`` (``'long'``, ``'short'``): whether to use the ``long`` or ``short`` array
   - ``syntax`` (``'long'``, ``'short'``): whether to use the ``long`` or ``short`` array
     syntax; defaults to ``'long'``
     syntax; defaults to ``'long'``
 
 
+* **backtick_to_shell_exec**
+
+  Converts backtick operators to shell_exec calls.
+
 * **binary_operator_spaces** [@Symfony]
 * **binary_operator_spaces** [@Symfony]
 
 
   Binary operators should be surrounded by space as configured.
   Binary operators should be surrounded by space as configured.
@@ -346,7 +350,7 @@ Choose from the list of available rules:
 
 
 * **combine_consecutive_issets**
 * **combine_consecutive_issets**
 
 
-  Using ``isset(X) &&`` multiple times should be done in one call.
+  Using ``isset($var) &&`` multiple times should be done in one call.
 
 
 * **combine_consecutive_unsets**
 * **combine_consecutive_unsets**
 
 
@@ -720,6 +724,12 @@ Choose from the list of available rules:
 
 
   *Risky rule: risky if any of the functions ``intval``, ``floatval``, ``doubleval``, ``strval`` or ``boolval`` are overridden.*
   *Risky rule: risky if any of the functions ``intval``, ``floatval``, ``doubleval``, ``strval`` or ``boolval`` are overridden.*
 
 
+* **multiline_comment_opening_closing**
+
+  DocBlocks must start with two asterisks, multiline comments must start
+  with a single asterisk, after the opening slash. Both must end with a
+  single asterisk before the closing slash.
+
 * **multiline_whitespace_before_semicolons**
 * **multiline_whitespace_before_semicolons**
 
 
   Forbid multi-line whitespace before the closing semicolon or move the
   Forbid multi-line whitespace before the closing semicolon or move the
@@ -1002,7 +1012,7 @@ Choose from the list of available rules:
   - ``assertions`` (``array``): list of assertion methods to fix; defaults to
   - ``assertions`` (``array``): list of assertion methods to fix; defaults to
     ``['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']``
     ``['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']``
 
 
-* **php_unit_dedicate_assert** [@PHPUnit30Migration:risky, @PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+* **php_unit_dedicate_assert** [@PHPUnit30Migration:risky, @PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
 
 
   PHPUnit assertions like "assertInternalType", "assertFileExists", should
   PHPUnit assertions like "assertInternalType", "assertFileExists", should
   be used over "assertTrue".
   be used over "assertTrue".
@@ -1014,7 +1024,7 @@ Choose from the list of available rules:
   - ``target`` (``'3.0'``, ``'3.5'``, ``'5.0'``, ``'5.6'``, ``'newest'``): target version of
   - ``target`` (``'3.0'``, ``'3.5'``, ``'5.0'``, ``'5.6'``, ``'newest'``): target version of
     PHPUnit; defaults to ``'5.0'``
     PHPUnit; defaults to ``'5.0'``
 
 
-* **php_unit_expectation** [@PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+* **php_unit_expectation** [@PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
 
 
   Usages of ``->setExpectedException*`` methods MUST be replaced by
   Usages of ``->setExpectedException*`` methods MUST be replaced by
   ``->expectException*`` methods.
   ``->expectException*`` methods.
@@ -1030,15 +1040,20 @@ Choose from the list of available rules:
 
 
   PHPUnit annotations should be a FQCNs including a root namespace.
   PHPUnit annotations should be a FQCNs including a root namespace.
 
 
-* **php_unit_mock** [@PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+* **php_unit_mock** [@PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
 
 
   Usages of ``->getMock`` and
   Usages of ``->getMock`` and
   ``->getMockWithoutInvokingTheOriginalConstructor`` methods MUST be
   ``->getMockWithoutInvokingTheOriginalConstructor`` methods MUST be
-  replaced by ``->createMock`` method.
+  replaced by ``->createMock`` or ``->createPartialMock`` methods.
 
 
   *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
   *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
 
 
-* **php_unit_namespaced** [@PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+  Configuration options:
+
+  - ``target`` (``'5.4'``, ``'5.5'``, ``'newest'``): target version of PHPUnit; defaults to
+    ``'newest'``
+
+* **php_unit_namespaced** [@PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
 
 
   PHPUnit classes MUST be used in namespaced version, eg
   PHPUnit classes MUST be used in namespaced version, eg
   ``\PHPUnit\Framework\TestCase`` instead of ``\PHPUnit_Framework_TestCase``.
   ``\PHPUnit\Framework\TestCase`` instead of ``\PHPUnit_Framework_TestCase``.
@@ -1050,7 +1065,7 @@ Choose from the list of available rules:
   - ``target`` (``'4.8'``, ``'5.7'``, ``'6.0'``, ``'newest'``): target version of PHPUnit;
   - ``target`` (``'4.8'``, ``'5.7'``, ``'6.0'``, ``'newest'``): target version of PHPUnit;
     defaults to ``'newest'``
     defaults to ``'newest'``
 
 
-* **php_unit_no_expectation_annotation** [@PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+* **php_unit_no_expectation_annotation** [@PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
 
 
   Usages of ``@expectedException*`` annotations MUST be replaced by
   Usages of ``@expectedException*`` annotations MUST be replaced by
   ``->setExpectedException*`` methods.
   ``->setExpectedException*`` methods.
@@ -1444,7 +1459,7 @@ Config file
 
 
 Instead of using command line options to customize the rule, you can save the
 Instead of using command line options to customize the rule, you can save the
 project configuration in a ``.php_cs.dist`` file in the root directory of your project.
 project configuration in a ``.php_cs.dist`` file in the root directory of your project.
-The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.9.0/src/ConfigInterface.php>`_
+The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.10.0/src/ConfigInterface.php>`_
 which lets you configure the rules, the files and directories that
 which lets you configure the rules, the files and directories that
 need to be analyzed. You may also create ``.php_cs`` file, which is
 need to be analyzed. You may also create ``.php_cs`` file, which is
 the local configuration that will be used instead of the project configuration. It
 the local configuration that will be used instead of the project configuration. It

+ 5 - 2
composer.json

@@ -34,10 +34,12 @@
     "require-dev": {
     "require-dev": {
         "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev",
         "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev",
         "justinrainbow/json-schema": "^5.0",
         "justinrainbow/json-schema": "^5.0",
+        "keradus/cli-executor": "^1.0",
         "mikey179/vfsStream": "^1.6",
         "mikey179/vfsStream": "^1.6",
         "php-coveralls/php-coveralls": "^2.0",
         "php-coveralls/php-coveralls": "^2.0",
         "php-cs-fixer/accessible-object": "^1.0",
         "php-cs-fixer/accessible-object": "^1.0",
         "phpunit/phpunit": "^5.7.23 || ^6.4.3",
         "phpunit/phpunit": "^5.7.23 || ^6.4.3",
+        "phpunitgoodpractices/traits": "^1.0",
         "symfony/phpunit-bridge": "^3.2.2 || ^4.0"
         "symfony/phpunit-bridge": "^3.2.2 || ^4.0"
     },
     },
     "suggest": {
     "suggest": {
@@ -54,11 +56,12 @@
     "autoload": {
     "autoload": {
         "psr-4": { "PhpCsFixer\\": "src/" },
         "psr-4": { "PhpCsFixer\\": "src/" },
         "classmap": [
         "classmap": [
-            "tests/Test/Assert/AssertTokensTrait.php",
             "tests/Test/AbstractFixerTestCase.php",
             "tests/Test/AbstractFixerTestCase.php",
             "tests/Test/AbstractIntegrationTestCase.php",
             "tests/Test/AbstractIntegrationTestCase.php",
+            "tests/Test/Assert/AssertTokensTrait.php",
             "tests/Test/IntegrationCase.php",
             "tests/Test/IntegrationCase.php",
-            "tests/Test/IntegrationCaseFactory.php"
+            "tests/Test/IntegrationCaseFactory.php",
+            "tests/TestCase.php"
         ]
         ]
     },
     },
     "autoload-dev": {
     "autoload-dev": {

+ 4 - 0
dev-tools/build.sh

@@ -16,3 +16,7 @@ composer global show kherge/box -q || composer global require --no-interaction -
 
 
 # build phar file
 # build phar file
 php -d phar.readonly=false $(composer config home)/vendor/bin/box build
 php -d phar.readonly=false $(composer config home)/vendor/bin/box build
+
+# revert changes to composer
+git checkout composer.json
+composer update --no-interaction --no-progress -q

+ 1 - 1
src/ConfigInterface.php

@@ -37,7 +37,7 @@ interface ConfigInterface
     /**
     /**
      * Returns files to scan.
      * Returns files to scan.
      *
      *
-     * @return iterable|string[]|\Traversable
+     * @return iterable|\Traversable
      */
      */
     public function getFinder();
     public function getFinder();
 
 

+ 1 - 1
src/Console/ConfigurationResolver.php

@@ -415,7 +415,7 @@ final class ConfigurationResolver
     /**
     /**
      * @throws InvalidConfigurationException
      * @throws InvalidConfigurationException
      *
      *
-     * @return bool
+     * @return string
      */
      */
     public function getProgress()
     public function getProgress()
     {
     {

+ 30 - 23
src/Differ/DiffConsoleFormatter.php

@@ -53,35 +53,42 @@ final class DiffConsoleFormatter
 
 
         $template = $isDecorated
         $template = $isDecorated
             ? $this->template
             ? $this->template
-            : preg_replace('/<[^<>]+>/', '', $this->template);
+            : preg_replace('/<[^<>]+>/', '', $this->template)
+        ;
 
 
         return sprintf(
         return sprintf(
             $template,
             $template,
-            implode(PHP_EOL, array_map(
-                static function ($string) use ($isDecorated, $lineTemplate) {
-                    if ($isDecorated) {
-                        $string = preg_replace(
-                            ['/^(\+.*)/', '/^(\-.*)/', '/^(@.*)/'],
-                            ['<fg=green>\1</fg=green>', '<fg=red>\1</fg=red>', '<fg=cyan>\1</fg=cyan>'],
-                            $string
-                        );
-                    }
+            implode(
+                PHP_EOL,
+                array_map(
+                    function ($string) use ($isDecorated, $lineTemplate) {
+                        if ($isDecorated) {
+                            $string = preg_replace_callback(
+                                [
+                                    '/^(\+.*)/',
+                                    '/^(\-.*)/',
+                                    '/^(@.*)/',
+                                ],
+                                function ($matches) {
+                                    if ('+' === $matches[0][0]) {
+                                        $colour = 'green';
+                                    } elseif ('-' === $matches[0][0]) {
+                                        $colour = 'red';
+                                    } else {
+                                        $colour = 'cyan';
+                                    }
 
 
-                    $templated = sprintf($lineTemplate, $string);
+                                    return sprintf('<fg=%s>%s</fg=%s>', $colour, OutputFormatter::escape($matches[0]), $colour);
+                                },
+                                $string
+                            );
+                        }
 
 
-                    if (' ' === $string) {
-                        $templated = rtrim($templated);
-                    }
-
-                    return $templated;
-                },
-                preg_split(
-                    "#\n\r|\n#",
-                    $isDecorated
-                        ? OutputFormatter::escape(rtrim($diff))
-                        : rtrim($diff)
+                        return sprintf($lineTemplate, $string);
+                    },
+                    preg_split('#\R#u', $diff)
                 )
                 )
-            ))
+            )
         );
         );
     }
     }
 }
 }

Некоторые файлы не были показаны из-за большого количества измененных файлов