From c9bcacdfb16a3293d977e4ec14be30232ea8c390 Mon Sep 17 00:00:00 2001 From: Refactorian Date: Sat, 2 Mar 2024 10:31:44 +0900 Subject: [PATCH] Update (#30) --- README.md | 18 ++++-- composer.json | 2 + composer.lock | 155 +++++++++++++++++++++++++++++++++++++++++++++++++- rector.php | 29 ++++++++++ 4 files changed, 197 insertions(+), 7 deletions(-) create mode 100644 rector.php diff --git a/README.md b/README.md index ce8b90d..2e2bab6 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,22 @@ ### Laravel Pint (Code Style Fixer | PHP-CS-Fixer) - Format all files - - `./vendor/bin/pint` + - `vendor/bin/pint` - Format specific files or directories - - `./vendor/bin/pint app/Models` - - `./vendor/bin/pint app/Models/User.php` + - `vendor/bin/pint app/Models` + - `vendor/bin/pint app/Models/User.php` - Format all files with preview - - `./vendor/bin/pint -v` + - `vendor/bin/pint -v` - Format uncommitted changes according to Git - - `./vendor/bin/pint --dirty` + - `vendor/bin/pint --dirty` - Inspect all files - - `./vendor/bin/pint --test` + - `vendor/bin/pint --test` + +### Rector +- Dry Run + - `vendor/bin/rector process --dry-run` +- Process + - `vendor/bin/rector process` # TODO - Improve environment diff --git a/composer.json b/composer.json index 3ed9e8e..e73a3ed 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,14 @@ "laravel/tinker": "^2.8" }, "require-dev": { + "driftingly/rector-laravel": "^1.0", "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^7.0", "phpunit/phpunit": "^10.1", + "rector/rector": "^1.0", "spatie/laravel-ignition": "^2.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 45c9a62..6f7ee71 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": "9c491b8531eec05ba41a11d9276a5749", + "content-hash": "ad9efdb95ea4d8598d8c9316d679417d", "packages": [ { "name": "brick/math", @@ -5686,6 +5686,41 @@ } ], "packages-dev": [ + { + "name": "driftingly/rector-laravel", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/driftingly/rector-laravel.git", + "reference": "b5a43f683d2c32850c050fda1983828ff97b8470" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/b5a43f683d2c32850c050fda1983828ff97b8470", + "reference": "b5a43f683d2c32850c050fda1983828ff97b8470", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "rector/rector": "^1.0" + }, + "type": "rector-extension", + "autoload": { + "psr-4": { + "RectorLaravel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Rector upgrades rules for Laravel Framework", + "support": { + "issues": "https://github.com/driftingly/rector-laravel/issues", + "source": "https://github.com/driftingly/rector-laravel/tree/1.0.0" + }, + "time": "2024-02-07T18:42:55+00:00" + }, { "name": "fakerphp/faker", "version": "v1.23.1", @@ -6348,6 +6383,68 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.59", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "e607609388d3a6d418a50a49f7940e8086798281" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", + "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "shasum": "" + }, + "require": { + "php": "^7.2|^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" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2024-02-20T13:59:13+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "10.1.11", @@ -6770,6 +6867,62 @@ ], "time": "2024-02-25T14:05:00+00:00" }, + { + "name": "rector/rector", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/258b775511e62a7188f8ce114d44acaf244d9a7d", + "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.57" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "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", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2024-02-16T07:53:23+00:00" + }, { "name": "sebastian/cli-parser", "version": "2.0.0", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..8ac06d7 --- /dev/null +++ b/rector.php @@ -0,0 +1,29 @@ +withPaths([ + __DIR__.'/app', + // __DIR__.'/bootstrap', + // __DIR__.'/config', + // __DIR__.'/lang', + // __DIR__.'/public', + // __DIR__.'/resources', + // __DIR__.'/routes', + // __DIR__.'/tests', + ]) + ->withSets([ + SetList::DEAD_CODE, + LevelSetList::UP_TO_PHP_82, + LaravelSetList::LARAVEL_100, + ]) + ->withRules([ + AddVoidReturnTypeWhereNoReturnRector::class, + ]);