diff --git a/composer.json b/composer.json index 0e7f1ea..6673a4b 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,8 @@ "laravel/pint": "^0.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.0", + "rector/rector": "^0.13.7" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 8ed31ef..f82a735 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": "27116ea101bf0dd938fe452b46b9c1b7", + "content-hash": "73eba85f9a7262ebc53f6fad1fe3c7d8", "packages": [ { "name": "laravel/pint", @@ -597,6 +597,65 @@ }, "time": "2021-12-08T12:19:24+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b7648d4ee9321665acaf112e49da9fd93df8fbd5", + "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5", + "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", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.8.0" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-06-29T08:53:31+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.15", @@ -1017,6 +1076,66 @@ ], "time": "2022-06-19T12:14:25+00:00" }, + { + "name": "rector/rector", + "version": "0.13.7", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "3574bf6399ae3951e31f3a9481e22ddb2f2f08b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/3574bf6399ae3951e31f3a9481e22ddb2f2f08b2", + "reference": "3574bf6399ae3951e31f3a9481e22ddb2f2f08b2", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.8" + }, + "conflict": { + "phpstan/phpdoc-parser": "<1.6.2", + "rector/rector-cakephp": "*", + "rector/rector-doctrine": "*", + "rector/rector-laravel": "*", + "rector/rector-nette": "*", + "rector/rector-phpoffice": "*", + "rector/rector-phpunit": "*", + "rector/rector-prefixed": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.13-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.13.7" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-06-29T12:00:57+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.1", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..90ad5e4 --- /dev/null +++ b/rector.php @@ -0,0 +1,24 @@ +paths([ + __DIR__ . '/src' + ]); + + // register a single rule + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + // define sets of rules + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_81, + SetList::CODE_QUALITY, + SetList::DEAD_CODE, + ]); +};