Rector configured

This commit is contained in:
Alex Wulf 2022-07-05 16:18:20 +02:00
parent d7ea3fc2a9
commit fd5d276359
3 changed files with 146 additions and 2 deletions

@ -7,7 +7,8 @@
"laravel/pint": "^0.2.3" "laravel/pint": "^0.2.3"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.0" "phpunit/phpunit": "^9.0",
"rector/rector": "^0.13.7"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

121
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "27116ea101bf0dd938fe452b46b9c1b7", "content-hash": "73eba85f9a7262ebc53f6fad1fe3c7d8",
"packages": [ "packages": [
{ {
"name": "laravel/pint", "name": "laravel/pint",
@ -597,6 +597,65 @@
}, },
"time": "2021-12-08T12:19:24+00:00" "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", "name": "phpunit/php-code-coverage",
"version": "9.2.15", "version": "9.2.15",
@ -1017,6 +1076,66 @@
], ],
"time": "2022-06-19T12:14:25+00:00" "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", "name": "sebastian/cli-parser",
"version": "1.0.1", "version": "1.0.1",

24
rector.php Normal file

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->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,
]);
};