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 1670042a6bc..cc7683329cc 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -92,7 +92,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 be970e32f7d..4456fd36529 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..b5effabcc0e 100644 --- a/.github/workflows/phpunit_and_phpstan_autoload_compat_test.yaml +++ b/.github/workflows/phpunit_and_phpstan_autoload_compat_test.yaml @@ -19,15 +19,15 @@ jobs: - name: 'Rector dev + PHPUnit 10' run: composer require "phpunit/phpunit:10.*" -W - php: 8.2 + php: 8.4 - name: 'Rector dev + PHPUnit 11' run: composer require "phpunit/phpunit:11.*" -W - php: 8.2 + php: 8.4 - 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/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 696ea08853f..f63e938be50 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", @@ -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", @@ -51,14 +50,12 @@ "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^12.5.6", - "rector/jack": "^0.5", - "rector/release-notes-generator": "^0.5.1", + "rector/jack": "^1.0", "rector/swiss-knife": "^2.4.1", "rector/type-perfect": "^2.1.2", "shipmonk/composer-dependency-analyser": "^1.8", - "symplify/easy-coding-standard": "^13.1", - "symplify/phpstan-extensions": "^12.0.2", - "symplify/phpstan-rules": "^14.9.11", + "symplify/easy-coding-standard": "^13.2", + "symplify/phpstan-rules": "^14.12", "symplify/vendor-patches": "^11.5", "tomasvotruba/class-leak": "^2.1", "tomasvotruba/unused-public": "^2.2", @@ -118,8 +115,7 @@ "fix-cs": "vendor/bin/ecs check --fix --ansi", "phpstan": "vendor/bin/phpstan analyse --ansi --memory-limit=512M", "rector": "bin/rector process --ansi", - "preload": "php build/build-preload.php .", - "release": "vendor/bin/rng --from-commit X --to-commit Y --remote-repository rectorphp/rector-symfony --remote-repository rectorphp/rector-doctrine --remote-repository rectorphp/rector-phpunit" + "preload": "php build/build-preload.php ." }, "extra": { "patches": { 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/phpstan.neon b/phpstan.neon index 6585a348409..efd9a79a4cc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -25,6 +25,13 @@ parameters: checkMissingCallableSignature: true treatPhpDocTypesAsCertain: false + # see https://github.com/symplify/phpstan-rules + symplify: + symfonyReturnType: true + laravelReturnType: true + pathStrings: true + ctor: true + paths: - rector.php - bin @@ -344,12 +351,9 @@ parameters: # list vs array - '#Parameter (.*?) expects list<(.*?)>, array<(.*?)> given#' - - identifier: symplify.noConstructorOverride - path: src/StaticTypeMapper/ValueObject/Type/SimpleStaticType.php - - - identifier: arrayValues.list - path: rules/CodingStyle/Application/UseImportsAdder.php + identifier: symplify.noConstructorOverride + path: src/StaticTypeMapper/ValueObject/Type/SimpleStaticType.php - message: '#Offset float\|int\|string might not exist on string#' @@ -449,12 +453,11 @@ parameters: - '#Provide more specific return type "Iterator|PhpParser\\Node" over abstract one#' - # BC layer - - - message: '#Access to deprecated property \$file of class Rector\\Rector\\AbstractRector#' - path: src/Rector/AbstractRector.php - # allowed - message: '#"@\\simplexml_load_string\(\$junitXml\)" is forbidden to use#' path: scripts/remove-unused-deps.php + + - + path: src/Util/Reflection/PrivatesAccessor.php + identifier: symplify.newOverSetters diff --git a/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php b/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php index 2a52fed02b9..29d919ea431 100644 --- a/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php +++ b/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php @@ -10,6 +10,7 @@ use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Name; +use PhpParser\Node\Param; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Do_; @@ -208,6 +209,6 @@ private function isInPropertyPromotedParams(Class_ $class, PropertyFetch|StaticP /** @var string $propertyName */ $propertyName = $this->getName($propertyFetch); $params = $this->promotedPropertyResolver->resolveFromClass($class); - return array_any($params, fn (Node $param): bool => $this->isName($param, $propertyName)); + return array_any($params, fn (Param $param): bool => $this->isName($param, $propertyName)); } } 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 0fadacd0134..72fe8c644fb 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -438,7 +438,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/PhpParser/Comparing/NodeComparator.php b/src/PhpParser/Comparing/NodeComparator.php index d9d5323c149..5bfac3d4c76 100644 --- a/src/PhpParser/Comparing/NodeComparator.php +++ b/src/PhpParser/Comparing/NodeComparator.php @@ -65,7 +65,7 @@ public function isNodeEqual(Node $singleNode, array $availableNodes): bool { return array_any( $availableNodes, - fn (Node|array|null $availableNode): bool => $this->areNodesEqual($singleNode, $availableNode) + fn (Node $availableNode): bool => $this->areNodesEqual($singleNode, $availableNode) ); }