Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_scoped_rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/claude_issue_fixer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis_no_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_command_with_option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e_with_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_with_no_diffs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/packages_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan_printer_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector_drupal_rector_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector_laravel_rector_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/remove_unused_deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weekly_pull_requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
4 changes: 2 additions & 2 deletions build/build-preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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'],
]);
2 changes: 1 addition & 1 deletion rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/no-php-file-in-fixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function findPhpFiles(array $directories): array
{
Assert::allDirectory($directories);

$finder = (new Finder())
$finder = new Finder()
->files()
->in($directories)
->path('/Fixture')
Expand All @@ -92,7 +92,7 @@ private function findFixtureFiles(array $directories): array
{
Assert::allDirectory($directories);

$finder = (new Finder())
$finder = new Finder()
->files()
->in($directories)
->path('Fixture')
Expand Down
3 changes: 2 additions & 1 deletion src/Bootstrap/AutoloadFileParameterResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/Set/ValueObject/SetList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Rector\Set\ValueObject;

use Deprecated;

/**
* @api
*/
Expand All @@ -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';
Expand Down
Loading