From 744e0bb9bb784af1aed22e4f699a43c9f9abcfcc Mon Sep 17 00:00:00 2001 From: idevakk <219866223+idevakk@users.noreply.github.com> Date: Mon, 29 Sep 2025 01:01:09 +0530 Subject: [PATCH] feat: add rector/rector --- composer.json | 3 +- composer.lock | 120 +++++++++++++++++++++++++++++++++++++++++++++++++- rector.php | 28 ++++++++++++ 3 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 7f13b0b..d93ad16 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.6", "pestphp/pest": "^3.8", - "pestphp/pest-plugin-laravel": "^3.2" + "pestphp/pest-plugin-laravel": "^3.2", + "rector/rector": "^2.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 1f81baa..2b9c6a0 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": "9602f78465f9cee4981e8234a4605e74", + "content-hash": "5260af5141165a63d2ab72e6650ae849", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -10762,6 +10762,64 @@ }, "time": "2025-08-30T15:50:23+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.1.29", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-phar-composer-source.git", + "reference": "git" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d618573eed4a1b6b75e37b2e0b65ac65c885d88e", + "reference": "d618573eed4a1b6b75e37b2e0b65ac65c885d88e", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-09-25T06:58:18+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "11.0.11", @@ -11206,6 +11264,66 @@ ], "time": "2025-08-16T05:19:02+00:00" }, + { + "name": "rector/rector", + "version": "2.1.7", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "c34cc07c4698f007a20dc5c99ff820089ae413ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/c34cc07c4698f007a20dc5c99ff820089ae413ce", + "reference": "c34cc07c4698f007a20dc5c99ff820089ae413ce", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.1.18" + }, + "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.1.7" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2025-09-10T11:13:58+00:00" + }, { "name": "sebastian/cli-parser", "version": "3.0.2", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..dd711c1 --- /dev/null +++ b/rector.php @@ -0,0 +1,28 @@ +withPaths([ + __DIR__ . '/app', + __DIR__ . '/bootstrap', + __DIR__ . '/resources', + __DIR__ . '/routes', + __DIR__ . '/config', + __DIR__ . '/tests', + ]) + ->withSkip([ + AddOverrideAttributeToOverriddenMethodsRector::class, + ]) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + typeDeclarations: true, + privatization: true, + earlyReturn: true, + strictBooleans: true, + ) + ->withPhpSets();