From 5e815eaa296a431421de8a60a42b26592afc0c9e Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Tue, 25 Feb 2025 11:47:31 +0100 Subject: [PATCH 01/14] chore: update README.md to list php8.4 (#262) ~ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa706a15a4..ae23da3b9d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Killer Features -- Install on **any PHP 7.2-PHP 8.3** project with any dependencies +- Install on **any PHP 7.2-PHP 8.4** project with any dependencies - Blazing fast with parallel run out of the box - Use [PHP_CodeSniffer or PHP-CS-Fixer](https://tomasvotruba.com/blog/2017/05/03/combine-power-of-php-code-sniffer-and-php-cs-fixer-in-3-lines/) - anything you like - Use **prepared sets** and [PHP CS Fixer sets](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst) to save time From 262e23f3914c2e369bffe6fa895f82836a912fd9 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Sun, 9 Mar 2025 21:19:14 +0000 Subject: [PATCH 02/14] Adds PHP 84 migration set (#263) --- src/Configuration/ECSConfigBuilder.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Configuration/ECSConfigBuilder.php b/src/Configuration/ECSConfigBuilder.php index 0272d4dd04..4a2b85cd20 100644 --- a/src/Configuration/ECSConfigBuilder.php +++ b/src/Configuration/ECSConfigBuilder.php @@ -307,6 +307,7 @@ public function withPhpCsFixerSets( bool $php81Migration = false, bool $php82Migration = false, bool $php83Migration = false, + bool $php84Migration = false, bool $phpunit30MigrationRisky = false, bool $phpunit32MigrationRisky = false, bool $phpunit35MigrationRisky = false, @@ -423,6 +424,10 @@ public function withPhpCsFixerSets( $this->dynamicSets[] = '@PHP83Migration'; } + if ($php84Migration) { + $this->dynamicSets[] = '@PHP84Migration'; + } + if ($phpunit30MigrationRisky) { $this->dynamicSets[] = '@PHPUnit30Migration:risky'; } From 9f32559d684d6901f24ba99fb74502fa6789f44a Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 17 Mar 2025 16:27:26 +0100 Subject: [PATCH 03/14] bump deps --- phpstan.neon | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 078787d9fd..d7a242a337 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -56,7 +56,6 @@ parameters: - tests/Skipper/Skipper/Skipper/SkipperTest.php - tests/Skipper/Skipper/Skip/SkipSkipperTest.php - tests/Skipper/SkipCriteriaResolver/SkippedPathsResolver/SkippedPathsResolverTest.php - - tests/FixerRunner/Application/FileProcessorTest.ph - src/Testing/PHPUnit/AbstractCheckerTestCase.php # optional From 2bbcbb90398b4bbd60f58496300d726d5136be83 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Mar 2025 10:21:53 +0100 Subject: [PATCH 04/14] remove linter, too detailed + bump symplify cs --- .github/workflows/code_analysis.yaml | 4 ---- composer.json | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index b549c41cf8..49b1a0ce71 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -32,10 +32,6 @@ jobs: name: 'Tests' run: vendor/bin/phpunit - - - name: 'PHP Linter' - run: vendor/bin/parallel-lint src tests - - name: 'Check Active Classes' run: vendor/bin/class-leak check bin src --ansi diff --git a/composer.json b/composer.json index 6710fa79f9..24dbffbf27 100644 --- a/composer.json +++ b/composer.json @@ -22,12 +22,11 @@ "squizlabs/php_codesniffer": "^3.11.3", "symfony/console": "^6.4.17", "symfony/finder": "^7.2.2", - "symplify/coding-standard": "^12.2.3", + "symplify/coding-standard": "^12.3.1", "symplify/easy-parallel": "^11.2.2", "webmozart/assert": "^1.11" }, "require-dev": { - "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0.3", @@ -36,7 +35,7 @@ "rector/rector": "^2.0.7", "rector/type-perfect": "^2.0.1", "symplify/phpstan-extensions": "^12.0", - "symplify/vendor-patches": "^11.3.7", + "symplify/vendor-patches": "^11.4", "tomasvotruba/class-leak": "^2.0", "tomasvotruba/type-coverage": "^2.0.1", "tomasvotruba/unused-public": "^2.0", From b103664a1c891093784eeb16e3269dbef225bc5e Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Mar 2025 10:30:27 +0100 Subject: [PATCH 05/14] bump to container 12 (#268) --- composer.json | 10 +++++----- phpstan.neon | 1 - src/Config/ECSConfig.php | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 24dbffbf27..cd904b992c 100644 --- a/composer.json +++ b/composer.json @@ -15,21 +15,21 @@ "php": ">=8.2", "composer/pcre": "^3.3.2", "composer/xdebug-handler": "^3.0.5", - "friendsofphp/php-cs-fixer": "^3.68.5", - "illuminate/container": "^11.40", + "friendsofphp/php-cs-fixer": "^3.73.1", + "illuminate/container": "^12.0", "nette/utils": "^4.0.5", "sebastian/diff": "^6.0.2", - "squizlabs/php_codesniffer": "^3.11.3", + "squizlabs/php_codesniffer": "^3.12", "symfony/console": "^6.4.17", "symfony/finder": "^7.2.2", - "symplify/coding-standard": "^12.3.1", + "symplify/coding-standard": "^12.3.2", "symplify/easy-parallel": "^11.2.2", "webmozart/assert": "^1.11" }, "require-dev": { "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan": "^2.1", - "phpstan/phpstan-phpunit": "^2.0.3", + "phpstan/phpstan-phpunit": "^2.0.5", "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^11.5.2", "rector/rector": "^2.0.7", diff --git a/phpstan.neon b/phpstan.neon index d7a242a337..42bf39da69 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,7 +13,6 @@ parameters: - rector.php excludePaths: - # deprecated, to be removed - scoper.php # tests diff --git a/src/Config/ECSConfig.php b/src/Config/ECSConfig.php index 80b7fdcd4e..6bd1e9d4bc 100644 --- a/src/Config/ECSConfig.php +++ b/src/Config/ECSConfig.php @@ -19,7 +19,6 @@ use Symplify\EasyCodingStandard\DependencyInjection\CompilerPass\RemoveMutualCheckersCompilerPass; use Symplify\EasyCodingStandard\DependencyInjection\SimpleParameterProvider; use Symplify\EasyCodingStandard\ValueObject\Option; -use Symplify\RuleDocGenerator\Contract\ConfigurableRuleInterface; use Webmozart\Assert\Assert; use Webmozart\Assert\InvalidArgumentException; @@ -105,7 +104,7 @@ public function ruleWithConfiguration(string $checkerClass, array $configuration $this->autowireWhitespaceAwareFixer($checkerClass); if (is_a($checkerClass, FixerInterface::class, true)) { - Assert::isAnyOf($checkerClass, [ConfigurableFixerInterface::class, ConfigurableRuleInterface::class]); + Assert::isAOf($checkerClass, ConfigurableFixerInterface::class); $this->extend($checkerClass, static function (ConfigurableFixerInterface $configurableFixer) use ( $configuration ): ConfigurableFixerInterface { From a6baec0f5d29011822f21c98dda2b396cc0c28e4 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Mar 2025 10:31:05 +0100 Subject: [PATCH 06/14] Bump --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cd904b992c..294a519029 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "composer/pcre": "^3.3.2", "composer/xdebug-handler": "^3.0.5", "friendsofphp/php-cs-fixer": "^3.73.1", - "illuminate/container": "^12.0", + "illuminate/container": "^12.3", "nette/utils": "^4.0.5", "sebastian/diff": "^6.0.2", "squizlabs/php_codesniffer": "^3.12", From 42188f9b510eb0333001a510d90997a1fb252964 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Mar 2025 10:58:51 +0100 Subject: [PATCH 07/14] cleanup preload --- build/target-repository/preload.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/target-repository/preload.php b/build/target-repository/preload.php index 43788e8d78..acd074b428 100644 --- a/build/target-repository/preload.php +++ b/build/target-repository/preload.php @@ -7,7 +7,5 @@ require_once __DIR__ . '/vendor/psr/container/src/ContainerExceptionInterface.php'; require_once __DIR__ . '/vendor/psr/container/src/NotFoundExceptionInterface.php'; require_once __DIR__ . '/vendor/psr/container/src/ContainerInterface.php'; -require_once __DIR__ . '/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/RuleDefinition.php'; -require_once __DIR__ . '/vendor/symplify/rule-doc-generator-contracts/src/Contract/DocumentedRuleInterface.php'; require_once __DIR__ . '/vendor/react/promise/src/functions.php'; require_once __DIR__ . '/vendor/symfony/deprecation-contracts/function.php'; From b07e6d8fdbea28ba68a8558887a0e0bbb631dca9 Mon Sep 17 00:00:00 2001 From: Matteo Trubini <7964032+matteotrubini@users.noreply.github.com> Date: Tue, 1 Apr 2025 05:37:30 +0200 Subject: [PATCH 08/14] [FIX] Psr12Test (#270) Ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/8459 First appeared in v3.74.0 Bump Composer to require v3.75.0 --- composer.json | 2 +- tests/Set/Psr12/Fixture/fixture.php.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 294a519029..0c5c2101e4 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "php": ">=8.2", "composer/pcre": "^3.3.2", "composer/xdebug-handler": "^3.0.5", - "friendsofphp/php-cs-fixer": "^3.73.1", + "friendsofphp/php-cs-fixer": "^3.75.0", "illuminate/container": "^12.3", "nette/utils": "^4.0.5", "sebastian/diff": "^6.0.2", diff --git a/tests/Set/Psr12/Fixture/fixture.php.inc b/tests/Set/Psr12/Fixture/fixture.php.inc index 1a8a5d979a..a8afa19c41 100644 --- a/tests/Set/Psr12/Fixture/fixture.php.inc +++ b/tests/Set/Psr12/Fixture/fixture.php.inc @@ -142,8 +142,8 @@ factoryFunction($arg1, $arg2, [ declare(strict_types=1); namespace Vendor\Package; -use Vendor\Package\SomeNamespace\ClassD as D; use Vendor\Package\{ClassA as A, ClassB, ClassC as C}; +use Vendor\Package\SomeNamespace\ClassD as D; use function Vendor\Package\{functionA, functionB, functionC}; use const Vendor\Package\{ConstantA, ConstantB, ConstantC}; From f1fab01561a736ddc5fbf7dc354f9493d31917ed Mon Sep 17 00:00:00 2001 From: Matteo Trubini <7964032+matteotrubini@users.noreply.github.com> Date: Tue, 1 Apr 2025 09:05:37 +0200 Subject: [PATCH 09/14] [IMP] SuperfluousConfigurationException message for the "common" set (#269) The error message lists all sets that should be removed, as they are already included, providing clearer guidance to the user. --- src/Configuration/ECSConfigBuilder.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Configuration/ECSConfigBuilder.php b/src/Configuration/ECSConfigBuilder.php index 4a2b85cd20..fc5189bf5e 100644 --- a/src/Configuration/ECSConfigBuilder.php +++ b/src/Configuration/ECSConfigBuilder.php @@ -229,9 +229,20 @@ public function withPreparedSets( // include all "common" sets $this->sets[] = SetList::COMMON; - if ($arrays || $spaces || $namespaces || $docblocks || $controlStructures || $phpunit || $comments) { + if (($alreadyIncludedSets = array_keys(array_filter([ + 'arrays' => $arrays, + 'spaces' => $spaces, + 'namespaces' => $namespaces, + 'docblocks' => $docblocks, + 'controlStructures' => $controlStructures, + 'phpunit' => $phpunit, + 'comments' => $comments, + ]))) !== []) { throw new SuperfluousConfigurationException( - 'This set is already included in the "common" set. You can remove it' + sprintf( + 'The following sets are already included in the "common" set: %s. Please remove them.', + implode(', ', $alreadyIncludedSets) + ) ); } } else { From 282a8b56bf7e5ffb3f052808181dd90190b1dcfc Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 23 Apr 2025 13:19:52 +0200 Subject: [PATCH 10/14] bump --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 0c5c2101e4..2bca73cdf5 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,11 @@ "composer/pcre": "^3.3.2", "composer/xdebug-handler": "^3.0.5", "friendsofphp/php-cs-fixer": "^3.75.0", - "illuminate/container": "^12.3", + "illuminate/container": "^12.10", "nette/utils": "^4.0.5", "sebastian/diff": "^6.0.2", - "squizlabs/php_codesniffer": "^3.12", - "symfony/console": "^6.4.17", + "squizlabs/php_codesniffer": "^3.12.2", + "symfony/console": "^6.4.20", "symfony/finder": "^7.2.2", "symplify/coding-standard": "^12.3.2", "symplify/easy-parallel": "^11.2.2", @@ -29,15 +29,15 @@ "require-dev": { "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan": "^2.1", - "phpstan/phpstan-phpunit": "^2.0.5", + "phpstan/phpstan-phpunit": "^2.0.6", "phpstan/phpstan-webmozart-assert": "^2.0", - "phpunit/phpunit": "^11.5.2", - "rector/rector": "^2.0.7", - "rector/type-perfect": "^2.0.1", + "phpunit/phpunit": "^11.5", + "rector/rector": "^2.0.12", + "rector/type-perfect": "^2.0.2", "symplify/phpstan-extensions": "^12.0", "symplify/vendor-patches": "^11.4", "tomasvotruba/class-leak": "^2.0", - "tomasvotruba/type-coverage": "^2.0.1", + "tomasvotruba/type-coverage": "^2.0.2", "tomasvotruba/unused-public": "^2.0", "tracy/tracy": "^2.10.9" }, From 4e1d3a1e67302697f756987eda78cc4a9b9b8be6 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 28 Apr 2025 00:48:08 +0200 Subject: [PATCH 11/14] bump symplify cs (#275) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2bca73cdf5..c53c3ed66e 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "squizlabs/php_codesniffer": "^3.12.2", "symfony/console": "^6.4.20", "symfony/finder": "^7.2.2", - "symplify/coding-standard": "^12.3.2", + "symplify/coding-standard": "^12.3.3", "symplify/easy-parallel": "^11.2.2", "webmozart/assert": "^1.11" }, From 5b5548f2d1c492b6a92067acf68b129efc1215bb Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 28 Apr 2025 01:30:53 +0200 Subject: [PATCH 12/14] cs --- config/set/symplify.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/set/symplify.php b/config/set/symplify.php index 36a27ddb07..0c6a7ab165 100644 --- a/config/set/symplify.php +++ b/config/set/symplify.php @@ -4,6 +4,7 @@ use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer; use Symplify\CodingStandard\Fixer\Annotation\RemovePHPStormAnnotationFixer; +use Symplify\CodingStandard\Fixer\Annotation\RemoveSetterGetterDocblockFixer; use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer; use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer; use Symplify\CodingStandard\Fixer\Commenting\ParamReturnAndVarTagMalformsFixer; @@ -21,6 +22,7 @@ RemovePHPStormAnnotationFixer::class, ParamReturnAndVarTagMalformsFixer::class, RemoveUselessDefaultCommentFixer::class, + RemoveSetterGetterDocblockFixer::class, // arrays ArrayListItemNewlineFixer::class, From f36d7f6cac9e24135a223cad55700da365ddd6f8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 28 Apr 2025 08:56:47 +0200 Subject: [PATCH 13/14] Bump rector config syntax downgrade --- build/rector-downgrade-php-72.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/build/rector-downgrade-php-72.php b/build/rector-downgrade-php-72.php index 0f32817a5a..e80b098913 100644 --- a/build/rector-downgrade-php-72.php +++ b/build/rector-downgrade-php-72.php @@ -3,15 +3,11 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\DowngradeLevelSetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->parallel(); - $rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]); - - $rectorConfig->skip([ +return RectorConfig::configure() + ->withDowngradeSets(php72: true) + ->withSkip([ '*/Tests/*', '*/tests/*', '*/Fixtures/DirectoryExpansion/.hiddenAbove/*' ]); -}; From f223a1b97f47bbcf50a6269a29fe9eb19a584cce Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 28 Apr 2025 08:58:16 +0200 Subject: [PATCH 14/14] add rector as dev --- full_ecs_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/full_ecs_build.sh b/full_ecs_build.sh index 4b23a8f572..495208ea29 100644 --- a/full_ecs_build.sh +++ b/full_ecs_build.sh @@ -11,7 +11,7 @@ rm -rf tests vendor/phpcsstandards/php_codesniffer/tests vendor/phpcsstandards/p # downgrade with rector mkdir rector-local -composer require rector/rector --working-dir rector-local +composer require rector/rector --working-dir rector-local --dev rector-local/vendor/bin/rector process bin config/config.php src vendor --config build/rector-downgrade-php-72.php --ansi # prefix