From 7b8f147844c082cc2c8d92001de7a9c8675f940d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sat, 27 Jan 2024 08:47:46 +0100 Subject: [PATCH] Code cleanup (#956) --- .dev-tools/composer.json | 2 +- .dev-tools/composer.lock | 18 +++++++++--------- tests/Fixer/AbstractFixerTestCase.php | 10 ++++++---- tests/Fixer/PhpdocArrayStyleFixerTest.php | 1 - 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.dev-tools/composer.json b/.dev-tools/composer.json index 0b5c04a5..56cf8e3e 100644 --- a/.dev-tools/composer.json +++ b/.dev-tools/composer.json @@ -10,7 +10,7 @@ "mi-schi/phpmd-extension": "^4.3", "phpmd/phpmd": "^2.15", "phpstan/extension-installer": "^1.3.1", - "phpstan/phpstan": "^1.10.56", + "phpstan/phpstan": "^1.10.57", "phpstan/phpstan-phpunit": "^1.3.15", "phpstan/phpstan-strict-rules": "^1.5.2", "squizlabs/php_codesniffer": "^3.8.1", diff --git a/.dev-tools/composer.lock b/.dev-tools/composer.lock index 8a633eaa..a6e63b46 100644 --- a/.dev-tools/composer.lock +++ b/.dev-tools/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e119893776d5f71a6f6a3efd90fb580e", + "content-hash": "cbcc035fe034b6b7b3ddebb4661ed5a6", "packages": [ { "name": "amphp/amp", @@ -792,16 +792,16 @@ }, { "name": "kubawerlos/php-cs-fixer-custom-fixers", - "version": "v3.19.0", + "version": "v3.19.2", "source": { "type": "git", "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", - "reference": "425ea445cc3e24dc68d6e4625721374c94ee83e5" + "reference": "e17ffa5d25dafed7a8bcf545fc1b576a664c87e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/425ea445cc3e24dc68d6e4625721374c94ee83e5", - "reference": "425ea445cc3e24dc68d6e4625721374c94ee83e5" + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/e17ffa5d25dafed7a8bcf545fc1b576a664c87e7", + "reference": "e17ffa5d25dafed7a8bcf545fc1b576a664c87e7" }, "require": { "ext-filter": "*", @@ -1278,16 +1278,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.56", + "version": "1.10.57", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "27816a01aea996191ee14d010f325434c0ee76fa" + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", - "reference": "27816a01aea996191ee14d010f325434c0ee76fa" + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" }, "require": { "php": "^7.2|^8.0" diff --git a/tests/Fixer/AbstractFixerTestCase.php b/tests/Fixer/AbstractFixerTestCase.php index 4ac47190..bb8fb1ef 100644 --- a/tests/Fixer/AbstractFixerTestCase.php +++ b/tests/Fixer/AbstractFixerTestCase.php @@ -100,15 +100,17 @@ final public function testCodeSampleEndsWithNewLine(): void */ final public function testCodeSampleIsChangedDuringFixing(): void { - $codeSample = self::getFixer()->getDefinition()->getCodeSamples()[0]; - if (self::getFixer() instanceof ConfigurableFixerInterface) { - self::getFixer()->configure($codeSample->getConfiguration() ?? []); + $fixer = self::getFixer(); + + $codeSample = $fixer->getDefinition()->getCodeSamples()[0]; + if ($fixer instanceof ConfigurableFixerInterface) { + $fixer->configure($codeSample->getConfiguration() ?? []); } Tokens::clearCache(); $tokens = Tokens::fromCode($codeSample->getCode()); - self::getFixer()->fix($this->createSplFileInfoDouble(), $tokens); + $fixer->fix($this->createSplFileInfoDouble(), $tokens); self::assertNotSame($codeSample->getCode(), $tokens->generateCode()); } diff --git a/tests/Fixer/PhpdocArrayStyleFixerTest.php b/tests/Fixer/PhpdocArrayStyleFixerTest.php index 1bdb17f5..37fa2c72 100644 --- a/tests/Fixer/PhpdocArrayStyleFixerTest.php +++ b/tests/Fixer/PhpdocArrayStyleFixerTest.php @@ -61,7 +61,6 @@ public static function provideFixCases(): iterable yield [ '|array|array|array */', '|float[]|array|string[] */', - ['style' => 'generic'], ]; yield [