Browse Source

Merge branch '2.16'

Julien Falque 4 years ago
parent
commit
c084ea91ee

+ 2 - 2
.travis.yml

@@ -83,14 +83,14 @@ jobs:
             <<: *STANDARD_TEST_JOB
             stage: Test
             php: 7.1
-            name: 7.1 | Symfony 4.1
+            name: 7.1 | Symfony ~4.1.0
             env: SYMFONY_DEPRECATIONS_HELPER=disabled PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="~4.1.0"
 
         -
             <<: *STANDARD_TEST_JOB
             stage: Test
             php: 7.2
-            name: 7.2 | Symfony 5.0
+            name: 7.2 | Symfony ^5.0
             env: SYMFONY_DEPRECATIONS_HELPER=disabled PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="^5.0"
 
         -

+ 1 - 1
composer.json

@@ -42,7 +42,7 @@
         "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1",
         "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1",
         "phpunitgoodpractices/traits": "^1.8",
-        "symfony/phpunit-bridge": "^4.3 || ^5.0",
+        "symfony/phpunit-bridge": "^5.1",
         "symfony/yaml": "^3.0 || ^4.0 || ^5.0"
     },
     "suggest": {

+ 1 - 1
dev-tools/install.sh

@@ -32,7 +32,7 @@ bin/checkbashisms --version
 
 echo λλλ shellcheck
 if [ ! -x bin/shellcheck ]; then
-    wget -qO- "https://storage.googleapis.com/shellcheck/shellcheck-${VERSION_SC}.linux.x86_64.tar.xz" \
+    wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${VERSION_SC}/shellcheck-${VERSION_SC}.linux.x86_64.tar.xz" \
         | tar -xJv -O shellcheck-${VERSION_SC}/shellcheck \
         > bin/shellcheck
     chmod u+x bin/shellcheck

+ 1 - 1
php-cs-fixer

@@ -12,7 +12,7 @@
  */
 
 if (getenv('PHP_CS_FIXER_FUTURE_MODE')) {
-    error_reporting(-1);
+    error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
 }
 
 if (defined('HHVM_VERSION_ID')) {

+ 1 - 1
src/Console/Application.php

@@ -46,7 +46,7 @@ final class Application extends BaseApplication
     public function __construct()
     {
         if (!getenv('PHP_CS_FIXER_FUTURE_MODE')) {
-            error_reporting(-1);
+            error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
         }
 
         parent::__construct('PHP CS Fixer', self::VERSION);

+ 5 - 5
tests/Fixer/CastNotation/LowercaseCastFixerTest.php

@@ -13,6 +13,7 @@
 namespace PhpCsFixer\Tests\Fixer\CastNotation;
 
 use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
+use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
 
 /**
  * @author SpacePossum
@@ -23,6 +24,8 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  */
 final class LowercaseCastFixerTest extends AbstractFixerTestCase
 {
+    use ExpectDeprecationTrait;
+
     /**
      * @param string      $expected
      * @param null|string $input
@@ -55,14 +58,11 @@ final class LowercaseCastFixerTest extends AbstractFixerTestCase
      * @dataProvider provideFixDeprecatedCases
      * @requires PHP 7.4
      * @group legacy
-     * @expectedDeprecation Unsilenced deprecation: The (real) cast is deprecated, use (float) instead
-     * @expectedDeprecation Unsilenced deprecation: The (real) cast is deprecated, use (float) instead
-     * @expectedDeprecation Unsilenced deprecation: The (real) cast is deprecated, use (float) instead
-     * @expectedDeprecation Unsilenced deprecation: The (real) cast is deprecated, use (float) instead
-     * @expectedDeprecation Unsilenced deprecation: The (real) cast is deprecated, use (float) instead
      */
     public function testFix74Deprecated($expected, $input = null)
     {
+        $this->expectDeprecation('The (real) cast is deprecated, use (float) instead');
+
         $this->doTest($expected, $input);
     }
 

+ 5 - 1
tests/Fixer/CastNotation/ShortScalarCastFixerTest.php

@@ -13,6 +13,7 @@
 namespace PhpCsFixer\Tests\Fixer\CastNotation;
 
 use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
+use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
 
 /**
  * @author SpacePossum
@@ -23,6 +24,8 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  */
 final class ShortScalarCastFixerTest extends AbstractFixerTestCase
 {
+    use ExpectDeprecationTrait;
+
     /**
      * @param string      $expected
      * @param null|string $input
@@ -55,10 +58,11 @@ final class ShortScalarCastFixerTest extends AbstractFixerTestCase
      * @dataProvider provideFixDeprecatedCases
      * @requires PHP 7.4
      * @group legacy
-     * @expectedDeprecation Unsilenced deprecation: The (real) cast is deprecated, use (float) instead
      */
     public function testFix74Deprecated($expected, $input = null)
     {
+        $this->expectDeprecation('The (real) cast is deprecated, use (float) instead');
+
         $this->doTest($expected, $input);
     }
 

+ 6 - 6
tests/Fixer/Comment/HeaderCommentFixerTest.php

@@ -517,7 +517,7 @@ echo 1;'
     public function testMisconfiguration($configuration, $exceptionMessage)
     {
         $this->expectException(\PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException::class);
-        $this->expectExceptionMessage('[header_comment] '.$exceptionMessage);
+        $this->expectExceptionMessageRegExp("#^\\[header_comment\\] {$exceptionMessage}$#");
 
         $this->configureFixerWithAliasedOptions($configuration);
     }
@@ -528,35 +528,35 @@ echo 1;'
             [[], 'Missing required configuration: The required option "header" is missing.'],
             [
                 ['header' => 1],
-                'Invalid configuration: The option "header" with value 1 is expected to be of type "string", but is of type "integer".',
+                'Invalid configuration: The option "header" with value 1 is expected to be of type "string", but is of type "(int|integer)"\.',
             ],
             [
                 [
                     'header' => '',
                     'comment_type' => 'foo',
                 ],
-                'Invalid configuration: The option "comment_type" with value "foo" is invalid. Accepted values are: "PHPDoc", "comment".',
+                'Invalid configuration: The option "comment_type" with value "foo" is invalid\. Accepted values are: "PHPDoc", "comment"\.',
             ],
             [
                 [
                     'header' => '',
                     'comment_type' => new \stdClass(),
                 ],
-                'Invalid configuration: The option "comment_type" with value stdClass is invalid. Accepted values are: "PHPDoc", "comment".',
+                'Invalid configuration: The option "comment_type" with value stdClass is invalid\. Accepted values are: "PHPDoc", "comment"\.',
             ],
             [
                 [
                     'header' => '',
                     'location' => new \stdClass(),
                 ],
-                'Invalid configuration: The option "location" with value stdClass is invalid. Accepted values are: "after_open", "after_declare_strict".',
+                'Invalid configuration: The option "location" with value stdClass is invalid\. Accepted values are: "after_open", "after_declare_strict"\.',
             ],
             [
                 [
                     'header' => '',
                     'separate' => new \stdClass(),
                 ],
-                'Invalid configuration: The option "separate" with value stdClass is invalid. Accepted values are: "both", "top", "bottom", "none".',
+                'Invalid configuration: The option "separate" with value stdClass is invalid\. Accepted values are: "both", "top", "bottom", "none"\.',
             ],
         ];
     }

+ 3 - 7
tests/Fixer/ControlStructure/YodaStyleFixerTest.php

@@ -700,11 +700,7 @@ $a#4
     public function testInvalidConfig(array $config, $expectedMessage)
     {
         $this->expectException(\PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException::class);
-        $this->expectExceptionMessageRegExp(sprintf(
-            '#^\[%s\] %s$#',
-            $this->fixer->getName(),
-            preg_quote($expectedMessage, '#')
-        ));
+        $this->expectExceptionMessageRegExp("#^\\[{$this->fixer->getName()}\\] {$expectedMessage}$#");
 
         $this->fixer->configure($config);
     }
@@ -715,8 +711,8 @@ $a#4
     public function provideInvalidConfigurationCases()
     {
         return [
-            [['equal' => 2], 'Invalid configuration: The option "equal" with value 2 is expected to be of type "bool" or "null", but is of type "integer".'],
-            [['_invalid_' => true], 'Invalid configuration: The option "_invalid_" does not exist. Defined options are: "always_move_variable", "equal", "identical", "less_and_greater".'],
+            [['equal' => 2], 'Invalid configuration: The option "equal" with value 2 is expected to be of type "bool" or "null", but is of type "(int|integer)"\.'],
+            [['_invalid_' => true], 'Invalid configuration: The option "_invalid_" does not exist\. Defined options are: "always_move_variable", "equal", "identical", "less_and_greater"\.'],
         ];
     }
 

+ 1 - 1
tests/Fixer/LanguageConstruct/IsNullFixerTest.php

@@ -40,7 +40,7 @@ final class IsNullFixerTest extends AbstractFixerTestCase
     public function testConfigurationWrongValue()
     {
         $this->expectException(\PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException::class);
-        $this->expectExceptionMessage('[is_null] Invalid configuration: The option "use_yoda_style" with value -1 is expected to be of type "bool", but is of type "integer".');
+        $this->expectExceptionMessageRegExp('#^\[is_null\] Invalid configuration: The option "use_yoda_style" with value -1 is expected to be of type "bool", but is of type "(int|integer)"\.$#');
         $this->fixer->configure(['use_yoda_style' => -1]);
     }
 

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