Browse Source

Merge branch 'master' into 3.0

# Conflicts:
#	composer.json
#	src/Console/Application.php
Dariusz Ruminski 6 years ago
parent
commit
44a9d29742

+ 2 - 3
.travis.yml

@@ -94,7 +94,6 @@ jobs:
             <<: *STANDARD_TEST_JOB
             stage: Test
             php: 7.3
-            env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
             before_script:
                 - php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,blank_line_after_opening_tag -q || travis_terminate 1
 
@@ -102,7 +101,7 @@ jobs:
             <<: *STANDARD_TEST_JOB
             stage: Test
             php: 7.3
-            env: COLLECT_COVERAGE=1 COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
+            env: COLLECT_COVERAGE=1
             before_install:
                 # check phpdbg
                 - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
@@ -153,4 +152,4 @@ jobs:
 
     allow_failures:
         - php: nightly
-        - env: COLLECT_COVERAGE=1 COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
+        - env: COLLECT_COVERAGE=1

+ 69 - 0
CHANGELOG.md

@@ -3,6 +3,48 @@ CHANGELOG for PHP CS Fixer
 
 This file contains changelogs for stable releases only.
 
+Changelog for v2.14.0
+---------------------
+
+* bug #4220 NativeFunctionInvocationFixer - namespaced strict to remove backslash (kubawerlos)
+* feature #3881 Add PhpdocVarAnnotationCorrectOrderFixer (kubawerlos)
+* feature #3915 Add HeredocIndentationFixer (gharlan)
+* feature #4002 NoSuperfluousPhpdocTagsFixer - Allow `mixed` in superfluous PHPDoc by configuration (MortalFlesh)
+* feature #4030 Add get_required_files and user_error aliases (ntzm)
+* feature #4043 NativeFunctionInvocationFixer - add option to remove redundant backslashes (kubawerlos)
+* feature #4102 Add NoUnsetCastFixer (SpacePossum)
+* minor #4025 Add phpdoc_types_order rule to Symfony's ruleset (carusogabriel)
+* minor #4213 [7.3] PHP7.3 integration tests (SpacePossum)
+* minor #4233 Add official support for PHP 7.3 (keradus)
+
+Changelog for v2.13.3
+---------------------
+
+* bug #4216 Psr4Fixer - fix for multiple classy elements in file (keradus, kubawerlos)
+* bug #4217 Psr0Fixer - class with anonymous class (kubawerlos)
+* bug #4219  NativeFunctionCasingFixer - handle T_RETURN_REF  (kubawerlos)
+* bug #4224 FunctionToConstantFixer - handle T_RETURN_REF (SpacePossum)
+* bug #4229 IsNullFixer - fix parenthesis not closed (guilliamxavier)
+* minor #4193 [7.3] CombineNestedDirnameFixer - support PHP 7.3 (kubawerlos)
+* minor #4198 [7.3] PowToExponentiationFixer - adding to PHP7.3 integration test (kubawerlos)
+* minor #4199 [7.3] MethodChainingIndentationFixer - add tests for PHP 7.3 (kubawerlos)
+* minor #4200 [7.3] ModernizeTypesCastingFixer - support PHP 7.3 (kubawerlos)
+* minor #4201 [7.3] MultilineWhitespaceBeforeSemicolonsFixer - add tests for PHP 7.3 (kubawerlos)
+* minor #4202 [7.3] ErrorSuppressionFixer - support PHP 7.3 (kubawerlos)
+* minor #4205 DX: PhpdocAlignFixer - refactor to use DocBlock (kubawerlos)
+* minor #4206 DX: enable multiline_whitespace_before_semicolons (keradus)
+* minor #4207 [7.3] RandomApiMigrationFixerTest - tests for 7.3 (SpacePossum)
+* minor #4208 [7.3] NativeFunctionCasingFixerTest - tests for 7.3 (SpacePossum)
+* minor #4209 [7.3] PhpUnitStrictFixerTest - tests for 7.3 (SpacePossum)
+* minor #4210 [7.3] PhpUnitConstructFixer - add test for PHP 7.3 (kubawerlos)
+* minor #4211 [7.3] PhpUnitDedicateAssertFixer - support PHP 7.3 (kubawerlos)
+* minor #4214 [7.3] NoUnsetOnPropertyFixerTest - tests for 7.3 (SpacePossum)
+* minor #4222 [7.3] PhpUnitExpectationFixer - support PHP 7.3 (kubawerlos)
+* minor #4223 [7.3] PhpUnitMockFixer - add tests for PHP 7.3 (kubawerlos)
+* minor #4230 [7.3] IsNullFixer - fix trailing comma (guilliamxavier)
+* minor #4232 DX: remove Utils::splitLines (kubawerlos)
+* minor #4234 [7.3] Test that "LITERAL instanceof X" is valid (guilliamxavier)
+
 Changelog for v2.13.2
 ---------------------
 
@@ -112,6 +154,33 @@ Changelog for v2.13.0
 * minor #3873 Add the native_function_invocation fixer in the Symfony:risky ruleset (stof)
 * minor #3979 DX: enable php_unit_method_casing (keradus)
 
+Changelog for v2.12.6
+---------------------
+
+* bug #4216 Psr4Fixer - fix for multiple classy elements in file (keradus, kubawerlos)
+* bug #4217 Psr0Fixer - class with anonymous class (kubawerlos)
+* bug #4219  NativeFunctionCasingFixer - handle T_RETURN_REF  (kubawerlos)
+* bug #4224 FunctionToConstantFixer - handle T_RETURN_REF (SpacePossum)
+* bug #4229 IsNullFixer - fix parenthesis not closed (guilliamxavier)
+* minor #4198 [7.3] PowToExponentiationFixer - adding to PHP7.3 integration test (kubawerlos)
+* minor #4199 [7.3] MethodChainingIndentationFixer - add tests for PHP 7.3 (kubawerlos)
+* minor #4200 [7.3] ModernizeTypesCastingFixer - support PHP 7.3 (kubawerlos)
+* minor #4201 [7.3] MultilineWhitespaceBeforeSemicolonsFixer - add tests for PHP 7.3 (kubawerlos)
+* minor #4202 [7.3] ErrorSuppressionFixer - support PHP 7.3 (kubawerlos)
+* minor #4205 DX: PhpdocAlignFixer - refactor to use DocBlock (kubawerlos)
+* minor #4206 DX: enable multiline_whitespace_before_semicolons (keradus)
+* minor #4207 [7.3] RandomApiMigrationFixerTest - tests for 7.3 (SpacePossum)
+* minor #4208 [7.3] NativeFunctionCasingFixerTest - tests for 7.3 (SpacePossum)
+* minor #4209 [7.3] PhpUnitStrictFixerTest - tests for 7.3 (SpacePossum)
+* minor #4210 [7.3] PhpUnitConstructFixer - add test for PHP 7.3 (kubawerlos)
+* minor #4211 [7.3] PhpUnitDedicateAssertFixer - support PHP 7.3 (kubawerlos)
+* minor #4214 [7.3] NoUnsetOnPropertyFixerTest - tests for 7.3 (SpacePossum)
+* minor #4222 [7.3] PhpUnitExpectationFixer - support PHP 7.3 (kubawerlos)
+* minor #4223 [7.3] PhpUnitMockFixer - add tests for PHP 7.3 (kubawerlos)
+* minor #4230 [7.3] IsNullFixer - fix trailing comma (guilliamxavier)
+* minor #4232 DX: remove Utils::splitLines (kubawerlos)
+* minor #4234 [7.3] Test that "LITERAL instanceof X" is valid (guilliamxavier)
+
 Changelog for v2.12.5
 ---------------------
 

+ 2 - 2
README.rst

@@ -46,7 +46,7 @@ or with specified version:
 
 .. code-block:: bash
 
-    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.2/php-cs-fixer.phar -O php-cs-fixer
+    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.14.0/php-cs-fixer.phar -O php-cs-fixer
 
 or with curl:
 
@@ -1760,7 +1760,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.13.2/src/ConfigInterface.php>`_
+The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.14.0/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

+ 1 - 1
composer.json

@@ -14,7 +14,7 @@
         }
     ],
     "require": {
-        "php": "^5.6 || >=7.0 <7.3",
+        "php": "^5.6 || ^7.0",
         "ext-json": "*",
         "ext-tokenizer": "*",
         "composer/semver": "^1.4",

+ 2 - 2
php-cs-fixer

@@ -25,8 +25,8 @@ if (defined('HHVM_VERSION_ID')) {
     } else {
         exit(1);
     }
-} elseif (!defined('PHP_VERSION_ID') || \PHP_VERSION_ID < 50600 || \PHP_VERSION_ID >= 70300) {
-    fwrite(STDERR, "PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.2.*.\n");
+} elseif (!defined('PHP_VERSION_ID') || \PHP_VERSION_ID < 50600 || \PHP_VERSION_ID >= 70400) {
+    fwrite(STDERR, "PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.3.*.\n");
 
     if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
         fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");

+ 8 - 1
src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php

@@ -326,12 +326,19 @@ $this->assertTrue(is_readable($a));
             return;
         }
 
+        $countCallCloseBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $countCallOpenBraceIndex);
+
+        $afterCountCallCloseBraceIndex = $tokens->getNextMeaningfulToken($countCallCloseBraceIndex);
+        if (!$tokens[$afterCountCallCloseBraceIndex]->equalsAny([')', ','])) {
+            return;
+        }
+
         $this->removeFunctionCall(
             $tokens,
             $defaultNamespaceTokenIndex,
             $countCallIndex,
             $countCallOpenBraceIndex,
-            $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $countCallOpenBraceIndex)
+            $countCallCloseBraceIndex
         );
 
         $tokens[$assertCall['index']] = new Token([

+ 5 - 0
tests/Fixer/PhpUnit/PhpUnitDedicateAssertFixerTest.php

@@ -423,6 +423,11 @@ $a# 5
                     $this->test(); // $this->assertSame($b, %s($a));
                 ',
             ],
+            'do not fix 7' => [
+                '<?php
+                    $this->assertSame(2, count($array) - 1);
+                ',
+            ],
         ];
     }
 

+ 6 - 0
tests/Fixtures/Integration/misc/PHP7_3.test

@@ -39,6 +39,9 @@ is_countable($foo);
 // https://wiki.php.net/rfc/list_reference_assignment
 [$a, &$b] = $array; // `list_syntax` rule
 
+// https://github.com/php/php-src/pull/2978 instanceof now allows literals as the first operand (the result is always false).
+null instanceof \stdClass;
+
 // https://wiki.php.net/rfc/trailing-comma-function-calls Trailing commas in function and method calls are now allowed.
 foo(
     $arg,
@@ -104,6 +107,9 @@ IS_COUNTABLE($foo);
 // https://wiki.php.net/rfc/list_reference_assignment
 list($a, &$b) = $array; // `list_syntax` rule
 
+// https://github.com/php/php-src/pull/2978 instanceof now allows literals as the first operand (the result is always false).
+null instanceof \stdClass;
+
 // https://wiki.php.net/rfc/trailing-comma-function-calls Trailing commas in function and method calls are now allowed.
 foo(
     $arg,

+ 1 - 1
tests/Smoke/CiIntegrationTest.php

@@ -128,7 +128,7 @@ final class CiIntegrationTest extends TestCase
             $steps[4],
         ]);
 
-        $optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.2.*.
+        $optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.3.*.
 Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.
 ';