From a2a50a451c57e0f2d8f08fb9d447a7f99f94c761 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 26 Jun 2026 13:22:47 +0200 Subject: [PATCH 1/3] cs --- rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php | 2 +- rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php | 2 +- .../ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php | 2 +- rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php | 2 +- .../Encapsed/VariableInStringInterpolationFixerRector.php | 2 +- rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php b/rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php index d4fb951adde..db8fb2aac7f 100644 --- a/rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php +++ b/rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php @@ -110,7 +110,7 @@ private function isJustThrownSameVariable(Catch_ $catch): bool } $catchItemStmt = $catch->stmts[0]; - if (!$catchItemStmt instanceof Expression || !$catchItemStmt->expr instanceof Throw_) { + if (! $catchItemStmt instanceof Expression || ! $catchItemStmt->expr instanceof Throw_) { return false; } diff --git a/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php b/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php index 5b28f56193c..56807925422 100644 --- a/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php +++ b/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php @@ -87,7 +87,7 @@ public function refactor(Node $node): array|null|int } $onlyCatchStmt = $onlyCatch->stmts[0]; - if (!$onlyCatchStmt instanceof Expression || !$onlyCatchStmt->expr instanceof Throw_) { + if (! $onlyCatchStmt instanceof Expression || ! $onlyCatchStmt->expr instanceof Throw_) { return null; } diff --git a/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php b/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php index 83526554188..2ca68107548 100644 --- a/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php +++ b/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php @@ -79,7 +79,7 @@ private function isFollowedByCurlyBracket(File $file, ArrayDimFetch $arrayDimFet if (isset($oldTokens[$endTokenPost]) && (string) $oldTokens[$endTokenPost] === '}') { $startTokenPos = $arrayDimFetch->getStartTokenPos(); - return !isset($oldTokens[$startTokenPos]) || (string) $oldTokens[$startTokenPos] !== '${'; + return ! isset($oldTokens[$startTokenPos]) || (string) $oldTokens[$startTokenPos] !== '${'; } return false; diff --git a/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php b/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php index e59ae4980d9..644ad758815 100644 --- a/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php +++ b/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php @@ -71,7 +71,7 @@ public function shouldSkipSwitch(Switch_ $switch, array $condAndExprs, ?Stmt $ne return false; } - return !$nextStmt instanceof Expression || !$nextStmt->expr instanceof Throw_; + return ! $nextStmt instanceof Expression || ! $nextStmt->expr instanceof Throw_; } /** diff --git a/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php b/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php index 9d2f60fdccc..6ecafd1e629 100644 --- a/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php +++ b/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php @@ -56,7 +56,7 @@ public function refactor(Node $node): ?Node $hasChanged = false; foreach ($node->parts as $part) { - if (! $part instanceof Variable && (!$part instanceof ArrayDimFetch || !$part->var instanceof Variable)) { + if (! $part instanceof Variable && (! $part instanceof ArrayDimFetch || ! $part->var instanceof Variable)) { continue; } diff --git a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php index 9434124cce5..60302e1c3d2 100644 --- a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php +++ b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php @@ -148,7 +148,7 @@ private function removeByName(ClassMethod | StaticCall | MethodCall $node, int $ return; } - if (!isset($node->params[$position]) || !$this->isName($node->params[$position], $name)) { + if (! isset($node->params[$position]) || ! $this->isName($node->params[$position], $name)) { return; } From c20d35647d9260272593dc088004c31546342fee Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 26 Jun 2026 13:31:11 +0200 Subject: [PATCH 2/3] bump to PHP 8.4 --- .github/workflows/build_scoped_rector.yaml | 2 +- .github/workflows/claude_issue_fixer.yaml | 2 +- .github/workflows/code_analysis.yaml | 2 +- .github/workflows/code_analysis_no_dev.yaml | 2 +- .github/workflows/e2e.yaml | 2 +- .github/workflows/e2e_command_with_option.yaml | 2 +- .github/workflows/e2e_with_cache.yaml | 4 ++-- .github/workflows/e2e_with_no_diffs.yaml | 2 +- .github/workflows/packages_tests.yaml | 2 +- .github/workflows/phpstan_printer_test.yaml | 2 +- .../workflows/phpunit_and_phpstan_autoload_compat_test.yaml | 2 +- .github/workflows/rector.yaml | 4 ++-- .github/workflows/rector_drupal_rector_dev.yaml | 2 +- .github/workflows/rector_laravel_rector_dev.yaml | 2 +- .github/workflows/remove_unused_deps.yaml | 2 +- .github/workflows/tests.yaml | 2 +- .github/workflows/weekly_pull_requests.yaml | 2 +- CLAUDE.md | 2 +- build/build-preload.php | 4 ++-- composer.json | 2 +- config/config.php | 2 +- rector.php | 4 ++++ scripts/no-php-file-in-fixtures.php | 4 ++-- src/Bootstrap/AutoloadFileParameterResolver.php | 3 ++- src/Configuration/RectorConfigBuilder.php | 3 ++- src/Set/ValueObject/SetList.php | 6 +++--- 26 files changed, 37 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build_scoped_rector.yaml b/.github/workflows/build_scoped_rector.yaml index 80d1624af84..30b96573a43 100644 --- a/.github/workflows/build_scoped_rector.yaml +++ b/.github/workflows/build_scoped_rector.yaml @@ -38,7 +38,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none # fixes https://github.com/rectorphp/rector/pull/4559/checks?check_run_id=1359814403, see https://github.com/shivammathur/setup-php#composer-github-oauth diff --git a/.github/workflows/claude_issue_fixer.yaml b/.github/workflows/claude_issue_fixer.yaml index 6212c6e7e7b..7c4d42d759b 100644 --- a/.github/workflows/claude_issue_fixer.yaml +++ b/.github/workflows/claude_issue_fixer.yaml @@ -30,7 +30,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.3' + php-version: '8.4' tools: composer:v2 coverage: none diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 84de1b31a50..f4e85d9af73 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -96,7 +96,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - uses: "ramsey/composer-install@v4" diff --git a/.github/workflows/code_analysis_no_dev.yaml b/.github/workflows/code_analysis_no_dev.yaml index 19bb5787803..532a6136ebb 100644 --- a/.github/workflows/code_analysis_no_dev.yaml +++ b/.github/workflows/code_analysis_no_dev.yaml @@ -17,7 +17,7 @@ jobs: # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - run: | diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 342fe2f7e97..3905e585f8d 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['8.3'] + php_version: ['8.4'] directory: - 'e2e/applied-auto-import' - 'e2e/applied-polyfill-php80' diff --git a/.github/workflows/e2e_command_with_option.yaml b/.github/workflows/e2e_command_with_option.yaml index e0edf1fcb7c..349f4281fba 100644 --- a/.github/workflows/e2e_command_with_option.yaml +++ b/.github/workflows/e2e_command_with_option.yaml @@ -27,7 +27,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - uses: "ramsey/composer-install@v4" diff --git a/.github/workflows/e2e_with_cache.yaml b/.github/workflows/e2e_with_cache.yaml index 97b6062b6a4..6c6f9daa675 100644 --- a/.github/workflows/e2e_with_cache.yaml +++ b/.github/workflows/e2e_with_cache.yaml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['8.3'] + php_version: ['8.4'] directory: - 'e2e/applied-rule-removed-node-with-cache' - 'e2e/timeout-file-not-cached' @@ -64,7 +64,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: '8.3' + php-version: '8.4' coverage: none - run: composer install --ansi diff --git a/.github/workflows/e2e_with_no_diffs.yaml b/.github/workflows/e2e_with_no_diffs.yaml index d44364b203c..e3af82a4d91 100644 --- a/.github/workflows/e2e_with_no_diffs.yaml +++ b/.github/workflows/e2e_with_no_diffs.yaml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['8.3'] + php_version: ['8.4'] directory: - 'e2e/applied-rule-removed-node-no-diffs' - 'e2e/applied-no-diffs-format-json' diff --git a/.github/workflows/packages_tests.yaml b/.github/workflows/packages_tests.yaml index ea071e6befe..0f910c4c15e 100644 --- a/.github/workflows/packages_tests.yaml +++ b/.github/workflows/packages_tests.yaml @@ -45,7 +45,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - run: composer config minimum-stability dev diff --git a/.github/workflows/phpstan_printer_test.yaml b/.github/workflows/phpstan_printer_test.yaml index 49e5e16d8fb..e40208db989 100644 --- a/.github/workflows/phpstan_printer_test.yaml +++ b/.github/workflows/phpstan_printer_test.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - php-versions: ['8.3'] + php-versions: ['8.4'] runs-on: ${{ matrix.os }} timeout-minutes: 3 diff --git a/.github/workflows/phpunit_and_phpstan_autoload_compat_test.yaml b/.github/workflows/phpunit_and_phpstan_autoload_compat_test.yaml index 85f737b3bfc..95394a4ecde 100644 --- a/.github/workflows/phpunit_and_phpstan_autoload_compat_test.yaml +++ b/.github/workflows/phpunit_and_phpstan_autoload_compat_test.yaml @@ -27,7 +27,7 @@ jobs: - name: 'Rector dev + PHPUnit 12' run: composer require "phpunit/phpunit:12.*" -W - php: 8.3 + php: 8.4 name: ${{ matrix.actions.name }} diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml index 743cb3ebc33..8cfd1220882 100644 --- a/.github/workflows/rector.yaml +++ b/.github/workflows/rector.yaml @@ -24,8 +24,8 @@ jobs: - uses: shivammathur/setup-php@v2 with: - # PHP 8.3 is required, so Rector's code is PHP 8.3 compatible even after refactoring - php-version: 8.3 + # PHP 8.4 is required, so Rector's code is PHP 8.4 compatible even after refactoring + php-version: 8.4 coverage: none - run: composer install --no-progress --ansi diff --git a/.github/workflows/rector_drupal_rector_dev.yaml b/.github/workflows/rector_drupal_rector_dev.yaml index 2be25002392..39b24b9354b 100644 --- a/.github/workflows/rector_drupal_rector_dev.yaml +++ b/.github/workflows/rector_drupal_rector_dev.yaml @@ -18,7 +18,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none # fixes https://github.com/rectorphp/rector/pull/4559/checks?check_run_id=1359814403, see https://github.com/shivammathur/setup-php#composer-github-oauth diff --git a/.github/workflows/rector_laravel_rector_dev.yaml b/.github/workflows/rector_laravel_rector_dev.yaml index ad80c419076..9d0304c5ced 100644 --- a/.github/workflows/rector_laravel_rector_dev.yaml +++ b/.github/workflows/rector_laravel_rector_dev.yaml @@ -18,7 +18,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none # fixes https://github.com/rectorphp/rector/pull/4559/checks?check_run_id=1359814403, see https://github.com/shivammathur/setup-php#composer-github-oauth diff --git a/.github/workflows/remove_unused_deps.yaml b/.github/workflows/remove_unused_deps.yaml index b5e50383456..0578eeeefe3 100644 --- a/.github/workflows/remove_unused_deps.yaml +++ b/.github/workflows/remove_unused_deps.yaml @@ -22,7 +22,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - run: composer install --no-progress --ansi diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 0b189cfa00b..5335d442d7c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - php-versions: ['8.3', '8.4', '8.5'] + php-versions: ['8.4', '8.5'] runs-on: ${{ matrix.os }} timeout-minutes: 4 diff --git a/.github/workflows/weekly_pull_requests.yaml b/.github/workflows/weekly_pull_requests.yaml index 01f59d89fb2..2f9bdadd3b0 100644 --- a/.github/workflows/weekly_pull_requests.yaml +++ b/.github/workflows/weekly_pull_requests.yaml @@ -41,7 +41,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - uses: "ramsey/composer-install@v4" diff --git a/CLAUDE.md b/CLAUDE.md index 79a3fcb55ee..ba2f186a252 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ Project-specific conventions for `rector/rector-src`. See `CONTRIBUTING.md` for ## Project -- PHP `^8.3` required. Do not use syntax that breaks on 8.3. +- PHP `^8.4` required. Do not use syntax that breaks on 8.4. - The package is `rector/rector-src`; it `replace`s `rector/rector`. - Sibling extension packages (`rector-doctrine`, `rector-symfony`, `rector-phpunit`, `rector-downgrade-php`) are pulled in as `dev-main`. diff --git a/build/build-preload.php b/build/build-preload.php index e35185370f8..80a2e084ffc 100755 --- a/build/build-preload.php +++ b/build/build-preload.php @@ -216,7 +216,7 @@ private function buildPreloadScriptPhpParser(string $buildDirectory, string $pre */ private function findPhpParserFiles(string $vendorDir): array { - $finder = (new Finder()) + $finder = new Finder() ->files() ->name('*.php') ->in($vendorDir . '/nikic/php-parser/lib/PhpParser') @@ -233,7 +233,7 @@ private function findPhpParserFiles(string $vendorDir): array */ private function findPhpDocParserFiles(string $vendorDir): array { - $finder = (new Finder()) + $finder = new Finder() ->files() ->name('*.php') ->in($vendorDir . '/phpstan/phpdoc-parser') diff --git a/composer.json b/composer.json index b2f5972e4d7..997a0de4d37 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "migration" ], "require": { - "php": "^8.3", + "php": "^8.4", "clue/ndjson-react": "^1.3", "composer/pcre": "^3.4.0", "composer/semver": "^3.4", diff --git a/config/config.php b/config/config.php index fa62bbed1f5..b1afe8533af 100644 --- a/config/config.php +++ b/config/config.php @@ -29,7 +29,7 @@ // use faster in-memory cache in CI. // CI always starts from scratch, therefore IO intensive caching is not worth it - if ((new CiDetector())->isCiDetected()) { + if (new CiDetector()->isCiDetected()) { $rectorConfig->cacheClass(MemoryCacheStorage::class); } diff --git a/rector.php b/rector.php index 57ef4f1632b..95f52ad3e7f 100644 --- a/rector.php +++ b/rector.php @@ -7,6 +7,7 @@ use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPublicMethodParameterRector; use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; +use Rector\Php84\Rector\Class_\DeprecatedAnnotationToDeprecatedAttributeRector; return RectorConfig::configure() ->withPreparedSets( @@ -58,4 +59,7 @@ __DIR__ . '/src/Configuration/RectorConfigBuilder.php', __DIR__ . '/src/Console/Notifier.php', ], + + // keep @deprecated annotation, as readable in IDE and tooling + DeprecatedAnnotationToDeprecatedAttributeRector::class => [__DIR__ . '/src/Set/ValueObject/SetList.php'], ]); diff --git a/scripts/no-php-file-in-fixtures.php b/scripts/no-php-file-in-fixtures.php index d363b557ff7..80d956a425d 100644 --- a/scripts/no-php-file-in-fixtures.php +++ b/scripts/no-php-file-in-fixtures.php @@ -72,7 +72,7 @@ private function findPhpFiles(array $directories): array { Assert::allDirectory($directories); - $finder = (new Finder()) + $finder = new Finder() ->files() ->in($directories) ->path('/Fixture') @@ -92,7 +92,7 @@ private function findFixtureFiles(array $directories): array { Assert::allDirectory($directories); - $finder = (new Finder()) + $finder = new Finder() ->files() ->in($directories) ->path('Fixture') diff --git a/src/Bootstrap/AutoloadFileParameterResolver.php b/src/Bootstrap/AutoloadFileParameterResolver.php index 7aa2462e7c4..b760f4a9c44 100644 --- a/src/Bootstrap/AutoloadFileParameterResolver.php +++ b/src/Bootstrap/AutoloadFileParameterResolver.php @@ -27,7 +27,8 @@ public static function resolveFromArgv(array $argv): void // handles "--autoload-file path", "--autoload-file=path" and "-a path"; // parallel workers receive the space-separated form, so all spellings must // normalize to the same value or main process and workers would disagree - $autoloadFile = (new ArgvInput($argv))->getParameterOption(['--autoload-file', '-a'], null); + $autoloadFile = new ArgvInput($argv) + ->getParameterOption(['--autoload-file', '-a'], null); if (! is_string($autoloadFile) || $autoloadFile === '') { return; } diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index b5fbc68f136..b1a14dd6def 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -444,7 +444,8 @@ public function withSkipPath(string $skipPath): self */ public function withRootFiles(): self { - $rootPhpFilesFinder = (new Finder())->files() + $rootPhpFilesFinder = new Finder() + ->files() ->in(getcwd()) ->depth(0) ->ignoreDotFiles(false) diff --git a/src/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index 03d0833c95a..e86985a3106 100644 --- a/src/Set/ValueObject/SetList.php +++ b/src/Set/ValueObject/SetList.php @@ -4,8 +4,6 @@ namespace Rector\Set\ValueObject; -use Deprecated; - /** * @api */ @@ -22,7 +20,9 @@ final class SetList public const string DEAD_CODE = __DIR__ . '/../../../config/set/dead-code.php'; - #[Deprecated(message: 'As too strict and not practical. Use code quality and coding style sets instead.')] + /** + * @deprecated As too strict and not practical. Use code quality and coding style sets instead. + */ public const string STRICT_BOOLEANS = __DIR__ . '/../../../config/set/strict-booleans.php'; public const string GMAGICK_TO_IMAGICK = __DIR__ . '/../../../config/set/gmagick-to-imagick.php'; From 0539a3fa26d4c520f42311a2f41bed6884cbb20a Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 26 Jun 2026 11:42:22 +0000 Subject: [PATCH 3/3] [ci-review] Remove unused dependencies --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 997a0de4d37..b52664c23f8 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,6 @@ "symfony/console": "^6.4.24", "symfony/filesystem": "^7.4", "symfony/finder": "^6.4", - "symfony/polyfill-php84": "^1.38", "symfony/process": "^7.4", "symplify/easy-parallel": "^11.2.2", "symplify/rule-doc-generator-contracts": "^11.2",