|
|
|
@ -3,29 +3,16 @@ |
|
|
|
declare(strict_types=1); |
|
|
|
declare(strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
use Rector\Config\RectorConfig; |
|
|
|
use Rector\Config\RectorConfig; |
|
|
|
use Rector\Core\ValueObject\PhpVersion; |
|
|
|
|
|
|
|
use Rector\Set\ValueObject\LevelSetList; |
|
|
|
use Rector\Set\ValueObject\LevelSetList; |
|
|
|
|
|
|
|
|
|
|
|
return static function (RectorConfig $rectorConfig): void { |
|
|
|
return RectorConfig::configure() |
|
|
|
// paths to refactor; solid alternative to CLI arguments |
|
|
|
->withPaths([ |
|
|
|
$rectorConfig->paths([ |
|
|
|
|
|
|
|
__DIR__ . '/src', |
|
|
|
__DIR__ . '/src', |
|
|
|
__DIR__ . '/tests', |
|
|
|
__DIR__ . '/tests', |
|
|
|
]); |
|
|
|
]) |
|
|
|
|
|
|
|
->withBootstrapFiles([ |
|
|
|
// Path to phpstan with extensions, that PHPSTan in Rector uses to determine types |
|
|
|
|
|
|
|
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rectorConfig->bootstrapFiles([ |
|
|
|
|
|
|
|
__DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php', |
|
|
|
__DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php', |
|
|
|
__DIR__ . '/vendor/autoload.php', |
|
|
|
__DIR__ . '/vendor/autoload.php', |
|
|
|
]); |
|
|
|
]) |
|
|
|
|
|
|
|
->withSets([LevelSetList::UP_TO_PHP_74]) |
|
|
|
// Define what rule sets will be applied |
|
|
|
; |
|
|
|
$rectorConfig->sets([ |
|
|
|
|
|
|
|
LevelSetList::UP_TO_PHP_74, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// is your PHP version different from the one your refactor to? |
|
|
|
|
|
|
|
$rectorConfig->phpVersion(PhpVersion::PHP_74); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|