From d211425ff2ce05c033b961b4ea2a5533e3eb74ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 4 May 2026 17:19:35 +0200 Subject: [PATCH] chore: integrate with rector --- composer.json | 3 +++ composer.lock | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++- rector.php | 24 ++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 1dbfc33..4bd9855 100644 --- a/composer.json +++ b/composer.json @@ -96,6 +96,8 @@ "symfony/polyfill-php81": "*" }, "scripts": { + "rector": "vendor/bin/rector process", + "rector:dry-run": "vendor/bin/rector process --dry-run", "auto-scripts": { "cache:clear": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd" @@ -124,6 +126,7 @@ "phpstan/phpstan-doctrine": "^2.0", "phpstan/phpstan-symfony": "^2.0", "phpunit/phpunit": "^9.5", + "rector/rector": "^2.4", "symfony/browser-kit": "6.4.*", "symfony/css-selector": "6.4.*", "symfony/debug-bundle": "6.4.*", diff --git a/composer.lock b/composer.lock index bd06292..ff80e5b 100644 --- a/composer.lock +++ b/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": "831615007594b0be80d80473f0c42e66", + "content-hash": "2fd76853483361829d0bdb4d8d68c7ef", "packages": [ { "name": "carbonphp/carbon-doctrine-types", @@ -12898,6 +12898,66 @@ ], "time": "2024-06-11T12:45:25+00:00" }, + { + "name": "rector/rector", + "version": "2.4.2", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "e645b6463c6a88ea5b44b17d3387d35a912c7946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e645b6463c6a88ea5b44b17d3387d35a912c7946", + "reference": "e645b6463c6a88ea5b44b17d3387d35a912c7946", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.1.48" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.4.2" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2026-04-16T13:07:34+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.2", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..5f718d3 --- /dev/null +++ b/rector.php @@ -0,0 +1,24 @@ +withPaths([ + __DIR__.'/src', + __DIR__.'/tests', + ]) + ->withImportNames( + importShortClasses: false, + removeUnusedImports: true, + ) + ->withComposerBased( + doctrine: true, + symfony: true, + ) + ->withSymfonyContainerXml( + __DIR__.'/var/cache/dev/App_KernelDevDebugContainer.xml' + ) + ->withFluentCallNewLine() + ->withCache(__DIR__.'/var/rector');