Browse Source

YodaFixer - fix problems of block statements followed by ternary statements

weareoutman 7 years ago
parent
commit
da81230285
10 changed files with 425 additions and 50 deletions
  1. 1 0
      .appveyor.yml
  2. 2 1
      .gitattributes
  3. 10 2
      .php_cs.dist
  4. 23 12
      .travis.yml
  5. 194 0
      CHANGELOG.md
  6. 1 1
      LICENSE
  7. 177 29
      README.rst
  8. 3 1
      circle.yml
  9. 10 4
      composer.json
  10. 4 0
      dev-tools/build.sh

+ 1 - 0
.appveyor.yml

@@ -39,4 +39,5 @@ before_test:
 test_script:
     - cd C:\projects\php-cs-fixer
     - vendor\bin\phpunit
+    - set PHP_CS_FIXER_FUTURE_MODE=1
     - php php-cs-fixer --diff --dry-run -v fix

+ 2 - 1
.gitattributes

@@ -1,4 +1,4 @@
-# @TODO 3.0 replace following `tests/... exportignore` with single `tests/ export-ignore`
+# @TODO 3.0 replace following `tests/... export-ignore` with single `tests/ export-ignore`
 tests/**/*Test.php export-ignore
 tests/AbstractDoctrineAnnotationFixerTestCase.php export-ignore
 tests/Differ/AbstractDifferTestCase.php export-ignore
@@ -6,6 +6,7 @@ tests/Fixtures/ export-ignore
 tests/Linter/AbstractLinterTestCase.php export-ignore
 tests/Report/AbstractReporterTestCase.php export-ignore
 tests/Test/AbstractTransformerTestCase.php export-ignore
+tests/Test/InternalIntegrationCaseFactory.php export-ignore
 
 .appveyor.yml export-ignore
 .composer-require-checker.json export-ignore

+ 10 - 2
.php_cs.dist

@@ -14,6 +14,7 @@ $config = PhpCsFixer\Config::create()
     ->setRiskyAllowed(true)
     ->setRules([
         '@PHP56Migration' => true,
+        '@PHPUnit60Migration:risky' => true,
         '@Symfony' => true,
         '@Symfony:risky' => true,
         'align_multiline_comment' => true,
@@ -21,11 +22,15 @@ $config = PhpCsFixer\Config::create()
         'blank_line_before_statement' => true,
         'combine_consecutive_issets' => true,
         'combine_consecutive_unsets' => true,
-        // one should use PHPUnit methods to set up expected exception instead of annotations
-        'general_phpdoc_annotation_remove' => ['annotations' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp']],
+        'compact_nullable_typehint' => true,
+        'escape_implicit_backslashes' => true,
+        'explicit_indirect_variable' => true,
+        'explicit_string_variable' => true,
+        'final_internal_class' => true,
         'header_comment' => ['header' => $header],
         'heredoc_to_nowdoc' => true,
         'list_syntax' => ['syntax' => 'long'],
+        'method_chaining_indentation' => true,
         'method_argument_space' => ['ensure_fully_multiline' => true],
         'no_extra_consecutive_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
         'no_null_property_initialization' => true,
@@ -39,6 +44,7 @@ $config = PhpCsFixer\Config::create()
         'ordered_class_elements' => true,
         'ordered_imports' => true,
         'php_unit_strict' => true,
+        'php_unit_test_annotation' => true,
         'php_unit_test_class_requires_covers' => true,
         'phpdoc_add_missing_param_annotation' => true,
         'phpdoc_order' => true,
@@ -66,6 +72,8 @@ try {
     $config->setRules([]);
 } catch (UnexpectedValueException $e) {
     $config->setRules([]);
+} catch (InvalidArgumentException $e) {
+    $config->setRules([]);
 }
 
 return $config;

+ 23 - 12
.travis.yml

@@ -38,15 +38,25 @@ jobs:
                 - export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
             script:
                 # @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/Test/AbstractFixerTestCase.php \
+                    | grep -v tests/Test/AbstractIntegrationCaseFactory.php \
+                    | grep -v tests/Test/AbstractIntegrationTestCase.php \
+                    | grep -v tests/Test/Assert/AssertTokensTrait.php \
+                    | grep -v tests/Test/IntegrationCase.php \
+                    | grep -v tests/Test/IntegrationCaseFactory.php \
+                    | grep -v tests/Test/IntegrationCaseFactoryInterface.php \
+                    | grep -v tests/Test/InternalIntegrationCaseFactory.php \
+                    | grep -v tests/TestCase.php \
+                    && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
                 - ./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
                 - ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json
 
 
         - &STANDARD_TEST_JOB
-            stage: Test
+            stage: Fast Test
             php: 7.0
             install:
                 # Composer: enforce given Symfony components version
@@ -57,22 +67,25 @@ jobs:
                 - composer info -D | sort
             script:
                 - vendor/bin/phpunit || travis_terminate 1
-                - php php-cs-fixer --diff --dry-run -v fix
+                - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
 
         -
             <<: *STANDARD_TEST_JOB
+            stage: Test
             php: 5.6
             env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
 
         -
             <<: *STANDARD_TEST_JOB
+            stage: Test
             php: 7.1
             env: SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="^4.0" MIN_STABILITY=dev
 
         -
             <<: *STANDARD_TEST_JOB
+            stage: Test
             php: 7.2
-            env: COLLECT_COVERAGE=1 SYMFONY_DEPRECATIONS_HELPER=weak
+            env: COLLECT_COVERAGE=1
             before_script:
                 # check phpdbg
                 - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
@@ -82,28 +95,26 @@ jobs:
             script:
                 - if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit || travis_terminate 1; fi
                 - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
-                - php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
-                - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/coveralls -v; fi
+                - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
+                - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/php-coveralls -v; fi
 
         -
             <<: *STANDARD_TEST_JOB
+            stage: Test
             php: nightly
             env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
             script:
                 - php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,native_function_invocation -q || travis_terminate 1
                 - vendor/bin/phpunit || travis_terminate 1
                 - git checkout . -q
-                - php php-cs-fixer --diff --dry-run -v fix
+                - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
 
         -
             stage: Deployment
             php: 7.1
             install: ./dev-tools/build.sh
             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:
                 provider: releases
                 api_key:

+ 194 - 0
CHANGELOG.md

@@ -3,6 +3,147 @@ CHANGELOG for PHP CS Fixer
 
 This file contains changelogs for stable releases only.
 
+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
+--------------------
+
+* feature #3063 Method chaining indentation fixer (boliev, julienfalque)
+* feature #3076 Add ExplicitStringVariableFixer (Slamdunk, keradus)
+* feature #3098 MethodSeparationFixer - add class elements separation options (SpacePossum, keradus)
+* feature #3155 Add EscapeImplicitBackslashesFixer (Slamdunk)
+* feature #3164 Add ExplicitIndirectVariableFixer (Slamdunk, keradus)
+* feature #3183 FinalInternalClassFixer introduction (keradus, SpacePossum)
+* feature #3187 StaticLambdaFixer - introduction (SpacePossum, keradus)
+* feature #3209 PhpdocAlignFixer - Make @method alignable (ntzm)
+* feature #3275 Add PhpUnitTestAnnotationFixer (BackEndTea, keradus)
+
+Changelog for v2.8.4
+--------------------
+
+* bug #3281 SelfAccessorFixer - stop modifying traits (kubawerlos)
+* minor #3195 Add self-update command test (julienfalque)
+* minor #3287 FileCacheManagerTest - drop duplicated line (keradus)
+* minor #3292 PHPUnit - set memory limit (veewee)
+* minor #3306 Token - better input validation (keradus)
+* minor #3310 Upgrade PHP Coveralls (keradus)
+
+Changelog for v2.8.3
+--------------------
+
+* bug #3173 SimplifiedNullReturnFixer - handle nullable return types (Slamdunk)
+* bug #3268 PhpUnitNoExpectationAnnotationFixer - add case with backslashes (keradus, Slamdunk)
+* bug #3272 PhpdocTrimFixer - unicode support (SpacePossum)
+
+Changelog for v2.8.2
+--------------------
+
+* bug #3225 PhpdocTrimFixer - Fix handling of lines without leading asterisk (julienfalque)
+* bug #3241 NoExtraConsecutiveBlankLinesFixer - do not crash on ^M LF only (SpacePossum)
+* bug #3242 PhpUnitNoExpectationAnnotationFixer - fix ' handling (keradus)
+* bug #3243 PhpUnitExpectationFixer - don't create ->expectExceptionMessage(null) (keradus)
+* bug #3244 PhpUnitNoExpectationAnnotationFixer - expectation extracted from annotation shall be separated from rest of code with one blank line (keradus)
+* bug #3259 PhpUnitNamespacedFixer - fix isCandidate to not rely on class declaration (keradus)
+* bug #3261 PhpUnitNamespacedFixer - properly fix next usage of already fixed class (keradus)
+* bug #3262 ToolInfo - support installation by branch as well (keradus)
+* bug #3263 NoBreakCommentFixer - Fix handling comment text with PCRE characters (julienfalque)
+* bug #3266 PhpUnitConstructFixer - multiple asserts bug (kubawerlos)
+* minor #3239 Improve contributing guide and issue template (julienfalque)
+* minor #3246 Make ToolInfo methods non-static (julienfalque)
+* minor #3249 PhpUnitNoExpectationAnnotationFixerTest - fix hidden conflict (keradus)
+* minor #3250 Travis: fail early, spare resources, save the Earth (Slamdunk, keradus)
+* minor #3251 Create Title for config file docs section (IanEdington)
+* minor #3254 AutoReview/FixerFactoryTest::testFixersPriority: verbose assertion message (Slamdunk)
+* minor #3255 IntegrationTest: output exception stack trace (Slamdunk)
+* minor #3257 README.rst - Fixed bullet list formatting (moebrowne)
+
+Changelog for v2.8.1
+--------------------
+
+* bug #3199 TokensAnalyzer - getClassyElements (SpacePossum)
+* bug #3208 BracesFixer - Fix for instantiation in control structures (julienfalque, SpacePossum)
+* bug #3215 BinaryOperatorSpacesFixer - Fix spaces around multiple exception catching (|) (ntzm)
+* bug #3216 AbstractLinesBeforeNamespaceFixer - add min. and max. option, not only single target count (SpacePossum)
+* bug #3217 TokenizerLinter - fix lack of linting when code is cached (SpacePossum, keradus)
+* minor #3200 Skip slow test when Xdebug is loaded (julienfalque)
+* minor #3211 Use udiff format in CI (julienfalque)
+* minor #3212 Handle rulesets unknown to fabbot.io (julienfalque)
+* minor #3219 Normalise references to GitHub in docs (ntzm)
+* minor #3226 Remove unused imports (ntzm)
+* minor #3231 Fix typos (ntzm)
+* minor #3234 Simplify Cache\Signature::equals (ntzm)
+* minor #3237 UnconfigurableFixer - use only LF (keradus)
+* minor #3238 AbstractFixerTest - fix @cover annotation (keradus)
+
+Changelog for v2.8.0
+--------------------
+
+* feature #3065 Add IncrementStyleFixer (kubawerlos)
+* feature #3119 Feature checkstyle reporter (K-Phoen)
+* feature #3162 Add udiff as diff format (SpacePossum, keradus)
+* feature #3170 Add CompactNullableTypehintFixer (jfcherng)
+* feature #3189 Add PHP_CS_FIXER_FUTURE_MODE env (keradus)
+* feature #3201 Add PHPUnit Migration rulesets and fixers (keradus)
+* minor #3149 AbstractProxyFixer - Support multiple proxied fixers (julienfalque)
+* minor #3160 Add DeprecatedFixerInterface (kubawerlos)
+* minor #3185 IndentationTypeFixerTest - clean up (SpacePossum, keradus)
+* minor #3198 Cleanup: add test that there is no deprecated fixer in rule set (kubawerlos)
+
+Changelog for v2.7.5
+--------------------
+
+* bug #3225 PhpdocTrimFixer - Fix handling of lines without leading asterisk (julienfalque)
+* bug #3241 NoExtraConsecutiveBlankLinesFixer - do not crash on ^M LF only (SpacePossum)
+* bug #3262 ToolInfo - support installation by branch as well (keradus)
+* bug #3263 NoBreakCommentFixer - Fix handling comment text with PCRE characters (julienfalque)
+* bug #3266 PhpUnitConstructFixer - multiple asserts bug (kubawerlos)
+* minor #3239 Improve contributing guide and issue template (julienfalque)
+* minor #3246 Make ToolInfo methods non-static (julienfalque)
+* minor #3250 Travis: fail early, spare resources, save the Earth (Slamdunk, keradus)
+* minor #3251 Create Title for config file docs section (IanEdington)
+* minor #3254 AutoReview/FixerFactoryTest::testFixersPriority: verbose assertion message (Slamdunk)
+* minor #3255 IntegrationTest: output exception stack trace (Slamdunk)
+
 Changelog for v2.7.4
 --------------------
 
@@ -334,6 +475,59 @@ Changelog for v2.3.0
 * minor #2568 Require PHP 5.6+ (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
+---------------------
+
+* bug #3281 SelfAccessorFixer - stop modifying traits (kubawerlos)
+* minor #3195 Add self-update command test (julienfalque)
+* minor #3292 PHPUnit - set memory limit (veewee)
+* minor #3306 Token - better input validation (keradus)
+
+Changelog for v2.2.12
+---------------------
+
+* bug #3173 SimplifiedNullReturnFixer - handle nullable return types (Slamdunk)
+* bug #3272 PhpdocTrimFixer - unicode support (SpacePossum)
+
+Changelog for v2.2.11
+---------------------
+
+* bug #3225 PhpdocTrimFixer - Fix handling of lines without leading asterisk (julienfalque)
+* bug #3262 ToolInfo - support installation by branch as well (keradus)
+* bug #3266 PhpUnitConstructFixer - multiple asserts bug (kubawerlos)
+* minor #3239 Improve contributing guide and issue template (julienfalque)
+* minor #3246 Make ToolInfo methods non-static (julienfalque)
+* minor #3250 Travis: fail early, spare resources, save the Earth (Slamdunk, keradus)
+* minor #3251 Create Title for config file docs section (IanEdington)
+* minor #3254 AutoReview/FixerFactoryTest::testFixersPriority: verbose assertion message (Slamdunk)
+
 Changelog for v2.2.10
 ---------------------
 

+ 1 - 1
LICENSE

@@ -1,4 +1,4 @@
-Copyright (c) 2012-2017 Fabien Potencier
+Copyright (c) 2012-2018 Fabien Potencier
                         Dariusz Rumiński
 
 Permission is hereby granted, free of charge, to any person obtaining a copy

+ 177 - 29
README.rst

@@ -6,7 +6,7 @@ whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2,
 or other community driven ones like the Symfony one.
 You can **also** define your (teams) style through configuration.
 
-It can modernize your code (like converting the `pow` function to the `**` operator on PHP 5.6)
+It can modernize your code (like converting the ``pow`` function to the ``**`` operator on PHP 5.6)
 and (micro) optimize it.
 
 If you are already using a linter to identify coding standards problems in your
@@ -46,7 +46,7 @@ or with specified version:
 
 .. code-block:: bash
 
-    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.7.4/php-cs-fixer.phar -O php-cs-fixer
+    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.9.1/php-cs-fixer.phar -O php-cs-fixer
 
 or with curl:
 
@@ -147,9 +147,13 @@ to merge paths from the config file and from the argument:
 
     $ php php-cs-fixer.phar fix --path-mode=intersection /path/to/dir
 
-The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml`` and ``junit``.
+The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml``, ``checkstyle`` and ``junit``.
+
+NOTE: the output for the following formats are generated in accordance with XML schemas
+
+* ``junit`` follows the `JUnit xml schema from Jenkins </doc/junit-10.xsd>`_
+* ``checkstyle`` follows the common `"checkstyle" xml schema </doc/checkstyle.xsd>`_
 
-NOTE: When using ``junit`` format report generates in accordance with JUnit xml schema from Jenkins (see docs/junit-10.xsd).
 
 The ``--verbose`` option will show the applied rules. When using the ``txt`` format it will also displays progress notifications.
 
@@ -188,13 +192,19 @@ Complete configuration for rules can be supplied using a ``json`` formatted stri
 
     $ php php-cs-fixer.phar fix /path/to/project --rules='{"concat_space": {"spacing": "none"}}'
 
-A combination of ``--dry-run`` and ``--diff`` will
-display a summary of proposed fixes, leaving your files unchanged.
+The ``--dry-run`` flag will run the fixer without making changes to your files.
+
+The ``--diff`` flag can be used to let the fixer output all the changes it makes.
+
+The ``--diff-format`` option allows to specify in which format the fixer should output the changes it makes:
+
+* ``udiff``: unified diff format;
+* ``sbd``: Sebastianbergmann/diff format (default when using `--diff` without specifying `diff-format`).
 
 The ``--allow-risky`` option (pass ``yes`` or ``no``) allows you to set whether risky rules may run. Default value is taken from config file.
 Risky rule is a rule, which could change code behaviour. By default no risky rules are run.
 
-The ``--stop-on-violation`` flag stops execution upon first file that needs to be fixed.
+The ``--stop-on-violation`` flag stops the execution upon first file that needs to be fixed.
 
 The ``--show-progress`` option allows you to choose the way process progress is rendered:
 
@@ -216,6 +226,13 @@ automatically fix anything:
 
     $ cat foo.php | php php-cs-fixer.phar fix --diff -
 
+Finally, if you don't need BC kept on CLI level, you might use `PHP_CS_FIXER_FUTURE_MODE` to start using options that
+would be default in next MAJOR release (unified differ, estimating, full-width progress indicator):
+
+.. code-block:: bash
+
+    $ PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer.phar fix -v --diff
+
 Choose from the list of available rules:
 
 * **align_multiline_comment**
@@ -307,6 +324,16 @@ Choose from the list of available rules:
   - ``space`` (``'none'``, ``'single'``): spacing to apply between cast and variable;
     defaults to ``'single'``
 
+* **class_attributes_separation** [@Symfony]
+
+  Class, trait and interface elements must be separated with one blank
+  line.
+
+  Configuration options:
+
+  - ``elements`` (``array``): list of classy elements; 'const', 'method',
+    'property'; defaults to ``['const', 'method', 'property']``
+
 * **class_definition** [@PSR2, @Symfony]
 
   Whitespace around the keywords of a class, trait or interfaces
@@ -327,12 +354,16 @@ Choose from the list of available rules:
 
 * **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**
 
   Calling ``unset`` on multiple items should be done in one call.
 
+* **compact_nullable_typehint**
+
+  Remove extra spaces in a nullable typehint.
+
 * **concat_space** [@Symfony]
 
   Concatenation should be spaced according configuration.
@@ -363,7 +394,7 @@ Choose from the list of available rules:
   Replaces ``dirname(__FILE__)`` expression with equivalent ``__DIR__``
   constant.
 
-  *Risky rule: risky when the function ``dirname()`` is overridden.*
+  *Risky rule: risky when the function ``dirname`` is overridden.*
 
 * **doctrine_annotation_array_assignment** [@DoctrineAnnotation]
 
@@ -517,6 +548,45 @@ Choose from the list of available rules:
 
   *Risky rule: risky if the ``ereg`` function is overridden.*
 
+* **escape_implicit_backslashes**
+
+  Escape implicit backslashes in strings and heredocs to ease the
+  understanding of which are special chars interpreted by PHP and which
+  not.
+
+  Configuration options:
+
+  - ``double_quoted`` (``bool``): whether to fix double-quoted strings; defaults to
+    ``true``
+  - ``heredoc_syntax`` (``bool``): whether to fix heredoc syntax; defaults to ``true``
+  - ``single_quoted`` (``bool``): whether to fix single-quoted strings; defaults to
+    ``false``
+
+* **explicit_indirect_variable**
+
+  Add curly braces to indirect variables to make them clear to understand.
+  Requires PHP >= 7.0.
+
+* **explicit_string_variable**
+
+  Converts implicit variables into explicit ones in double-quoted strings
+  or heredoc syntax.
+
+* **final_internal_class**
+
+  Internal classes should be ``final``.
+
+  *Risky rule: changing classes to ``final`` might cause code execution to break.*
+
+  Configuration options:
+
+  - ``annotation-black-list`` (``array``): class level annotations tags that must be
+    omitted to fix the class, even if all of the white list ones are used
+    as well. (case insensitive); defaults to ``['@final', '@Entity', '@ORM']``
+  - ``annotation-white-list`` (``array``): class level annotations tags that must be
+    set in order to fix the class. (case insensitive); defaults to
+    ``['@internal']``
+
 * **full_opening_tag** [@PSR1, @PSR2, @Symfony]
 
   PHP code must use the long ``<?php`` tags or short-echo ``<?=`` tags and not
@@ -555,7 +625,7 @@ Choose from the list of available rules:
   - ``annotations`` (``array``): list of annotations to remove, e.g. ``["author"]``;
     defaults to ``[]``
 
-* **hash_to_slash_comment** [@Symfony]
+* **hash_to_slash_comment**
 
   Single line comments should use double slashes ``//`` and not hash ``#``.
   DEPRECATED: use ``single_line_comment_style`` instead.
@@ -583,15 +653,25 @@ Choose from the list of available rules:
   Include/Require and file path should be divided with a single space.
   File path should not be placed under brackets.
 
+* **increment_style** [@Symfony]
+
+  Pre- or post-increment and decrement operators should be used if
+  possible.
+
+  Configuration options:
+
+  - ``style`` (``'post'``, ``'pre'``): whether to use pre- or post-increment and
+    decrement operators; defaults to ``'pre'``
+
 * **indentation_type** [@PSR2, @Symfony]
 
   Code MUST use configured indentation type.
 
 * **is_null** [@Symfony:risky]
 
-  Replaces is_null(parameter) expression with ``null === parameter``.
+  Replaces ``is_null($var)`` expression with ``null === $var``.
 
-  *Risky rule: risky when the function ``is_null()`` is overridden.*
+  *Risky rule: risky when the function ``is_null`` is overridden.*
 
   Configuration options:
 
@@ -653,9 +733,15 @@ Choose from the list of available rules:
   - ``keep_multiple_spaces_after_comma`` (``bool``): whether keep multiple spaces
     after comma; defaults to ``false``
 
-* **method_separation** [@Symfony]
+* **method_chaining_indentation**
+
+  Method chaining MUST be properly indented. Method chaining with
+  different levels of indentation is not supported.
 
-  Methods must be separated with one blank line.
+* **method_separation**
+
+  Methods must be separated with one blank line. DEPRECATED: use
+  ``class_attributes_separation`` instead.
 
 * **modernize_types_casting** [@Symfony:risky]
 
@@ -939,7 +1025,7 @@ Choose from the list of available rules:
   - ``assertions`` (``array``): list of assertion methods to fix; defaults to
     ``['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']``
 
-* **php_unit_dedicate_assert** [@Symfony:risky]
+* **php_unit_dedicate_assert** [@Symfony:risky, @PHPUnit30Migration:risky, @PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
 
   PHPUnit assertions like "assertInternalType", "assertFileExists", should
   be used over "assertTrue".
@@ -948,16 +1034,60 @@ Choose from the list of available rules:
 
   Configuration options:
 
-  - ``functions`` (``array``): list of assertions to fix; defaults to
-    ``['array_key_exists', 'empty', 'file_exists', 'is_array', 'is_bool',
-    'is_boolean', 'is_callable', 'is_double', 'is_float', 'is_infinite',
-    'is_int', 'is_integer', 'is_long', 'is_nan', 'is_null', 'is_numeric',
-    'is_object', 'is_real', 'is_resource', 'is_scalar', 'is_string']``
+  - ``functions`` (``null``): (deprecated, use ``target`` instead) List of assertions
+    to fix (overrides ``target``); defaults to ``null``
+  - ``target`` (``'3.0'``, ``'3.5'``, ``'5.0'``, ``'5.6'``, ``'newest'``): target version of
+    PHPUnit; defaults to ``'5.0'``
+
+* **php_unit_expectation** [@PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+
+  Usages of ``->setExpectedException*`` methods MUST be replaced by
+  ``->expectException*`` methods.
+
+  *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
+
+  Configuration options:
+
+  - ``target`` (``'5.2'``, ``'5.6'``, ``'newest'``): target version of PHPUnit; defaults to
+    ``'newest'``
 
 * **php_unit_fqcn_annotation** [@Symfony]
 
   PHPUnit annotations should be a FQCNs including a root namespace.
 
+* **php_unit_mock** [@PHPUnit54Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
+
+  Usages of ``->getMock`` and
+  ``->getMockWithoutInvokingTheOriginalConstructor`` methods MUST be
+  replaced by ``->createMock`` method.
+
+  *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]
+
+  PHPUnit classes MUST be used in namespaced version, eg
+  ``\PHPUnit\Framework\TestCase`` instead of ``\PHPUnit_Framework_TestCase``.
+
+  *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
+
+  Configuration options:
+
+  - ``target`` (``'4.8'``, ``'5.7'``, ``'6.0'``, ``'newest'``): target version of PHPUnit;
+    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]
+
+  Usages of ``@expectedException*`` annotations MUST be replaced by
+  ``->setExpectedException*`` methods.
+
+  *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
+
+  Configuration options:
+
+  - ``target`` (``'3.2'``, ``'4.3'``, ``'newest'``): target version of PHPUnit; defaults to
+    ``'newest'``
+  - ``use_class_const`` (``bool``): use ::class notation; defaults to ``true``
+
 * **php_unit_strict**
 
   PHPUnit methods like ``assertSame`` should be used instead of
@@ -971,6 +1101,19 @@ Choose from the list of available rules:
     ``['assertAttributeEquals', 'assertAttributeNotEquals', 'assertEquals',
     'assertNotEquals']``
 
+* **php_unit_test_annotation**
+
+  Adds or removes @test annotations from tests, following configuration.
+
+  *Risky rule: this fixer may change the name of your tests, and could cause incompatibility with abstract classes or interfaces.*
+
+  Configuration options:
+
+  - ``case`` (``'camel'``, ``'snake'``): whether to camel or snake case when adding the
+    test prefix; defaults to ``'camel'``
+  - ``style`` (``'annotation'``, ``'prefix'``): whether to use the @test annotation or
+    not; defaults to ``'prefix'``
+
 * **php_unit_test_class_requires_covers**
 
   Adds a default ``@coversNothing`` annotation to PHPUnit test classes that
@@ -1101,13 +1244,14 @@ Choose from the list of available rules:
 
 * **pow_to_exponentiation** [@PHP56Migration:risky, @PHP70Migration:risky, @PHP71Migration:risky]
 
-  Converts ``pow()`` to the ``**`` operator.
+  Converts ``pow`` to the ``**`` operator.
 
-  *Risky rule: risky when the function ``pow()`` is overridden.*
+  *Risky rule: risky when the function ``pow`` is overridden.*
 
-* **pre_increment** [@Symfony]
+* **pre_increment**
 
   Pre incrementation/decrementation should be used if possible.
+  DEPRECATED: use ``increment_style`` instead.
 
 * **protected_to_private** [@Symfony]
 
@@ -1156,8 +1300,8 @@ Choose from the list of available rules:
 
 * **self_accessor** [@Symfony]
 
-  Inside a classy element "self" should be preferred to the class name
-  itself.
+  Inside class or interface element "self" should be preferred to the
+  class name itself.
 
 * **semicolon_after_instruction** [@Symfony]
 
@@ -1178,8 +1322,6 @@ Choose from the list of available rules:
 
   A return statement wishing to return ``void`` should not return ``null``.
 
-  *Risky rule: risky since PHP 7.1 as ``null`` and ``void`` can be hinted as return type and have different meaning.*
-
 * **single_blank_line_at_eof** [@PSR2, @Symfony]
 
   A PHP file without end tag must always end with a single empty line
@@ -1208,7 +1350,7 @@ Choose from the list of available rules:
   Each namespace use MUST go on its own line and there MUST be one blank
   line after the use statements block.
 
-* **single_line_comment_style**
+* **single_line_comment_style** [@Symfony]
 
   Single-line comments and multi-line comments with only one line of
   actual content should use the ``//`` syntax.
@@ -1235,6 +1377,12 @@ Choose from the list of available rules:
 
   Replace all ``<>`` with ``!=``.
 
+* **static_lambda**
+
+  Lambdas not (indirect) referencing ``$this`` must be declared ``static``.
+
+  *Risky rule: risky when using "->bindTo" on lambdas without referencing to ``$this``.*
+
 * **strict_comparison**
 
   Comparisons should be strict.
@@ -1326,7 +1474,7 @@ Config file
 
 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.
-The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.7.4/src/ConfigInterface.php>`_
+The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.9.1/src/ConfigInterface.php>`_
 which lets you configure the rules, the files and directories that
 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

+ 3 - 1
circle.yml

@@ -14,6 +14,8 @@ dependencies:
         - brew update
         - brew tap homebrew/homebrew-php
         - brew install php71
+        - mkdir $(brew --prefix)/etc/php/7.1/conf.d
+        - echo "memory_limit = 512M" > $(brew --prefix)/etc/php/7.1/conf.d/memory.ini
         - curl -sS https://getcomposer.org/installer | php
         - php composer.phar global show hirak/prestissimo -q || php composer.phar global require --no-interaction --no-progress --optimize-autoloader hirak/prestissimo
     override:
@@ -22,4 +24,4 @@ dependencies:
 test:
     override:
         - vendor/bin/phpunit
-        - php php-cs-fixer --diff --dry-run -v fix
+        - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix

+ 10 - 4
composer.json

@@ -20,7 +20,7 @@
         "composer/semver": "^1.4",
         "doctrine/annotations": "^1.2",
         "gecko-packages/gecko-php-unit": "^2.0 || ^3.0",
-        "php-cs-fixer/diff": "^1.0",
+        "php-cs-fixer/diff": "^1.2",
         "symfony/console": "^3.2 || ^4.0",
         "symfony/event-dispatcher": "^3.0 || ^4.0",
         "symfony/filesystem": "^3.0 || ^4.0",
@@ -34,7 +34,9 @@
     "require-dev": {
         "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev",
         "justinrainbow/json-schema": "^5.0",
-        "php-coveralls/php-coveralls": "^1.0.2",
+        "keradus/cli-executor": "^1.0",
+        "mikey179/vfsStream": "^1.6",
+        "php-coveralls/php-coveralls": "^2.0",
         "php-cs-fixer/accessible-object": "^1.0",
         "phpunit/phpunit": "^5.7.23 || ^6.4.3",
         "symfony/phpunit-bridge": "^3.2.2 || ^4.0"
@@ -53,11 +55,15 @@
     "autoload": {
         "psr-4": { "PhpCsFixer\\": "src/" },
         "classmap": [
-            "tests/Test/Assert/AssertTokensTrait.php",
             "tests/Test/AbstractFixerTestCase.php",
+            "tests/Test/AbstractIntegrationCaseFactory.php",
             "tests/Test/AbstractIntegrationTestCase.php",
+            "tests/Test/Assert/AssertTokensTrait.php",
             "tests/Test/IntegrationCase.php",
-            "tests/Test/IntegrationCaseFactory.php"
+            "tests/Test/IntegrationCaseFactory.php",
+            "tests/Test/IntegrationCaseFactoryInterface.php",
+            "tests/Test/InternalIntegrationCaseFactory.php",
+            "tests/TestCase.php"
         ]
     },
     "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
 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

Some files were not shown because too many files changed in this diff