2020-09-25 10:41:42 +07:00
|
|
|
<?php
|
|
|
|
|
2021-02-01 13:23:04 +07:00
|
|
|
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
|
|
|
|
use Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector;
|
2020-09-25 10:41:42 +07:00
|
|
|
use Rector\Core\Configuration\Option;
|
2021-01-08 13:40:57 +07:00
|
|
|
use Rector\Core\ValueObject\PhpVersion;
|
2021-02-02 02:39:20 +07:00
|
|
|
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
|
2020-10-30 20:51:53 +07:00
|
|
|
use Rector\Performance\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
|
2020-10-03 14:44:37 +07:00
|
|
|
use Rector\SOLID\Rector\If_\RemoveAlwaysElseRector;
|
2020-09-25 10:41:42 +07:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
2020-10-23 19:19:47 +07:00
|
|
|
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
|
2020-09-28 18:56:04 +07:00
|
|
|
use Utils\Rector\UnderscoreToCamelCaseVariableNameRector;
|
2020-09-25 10:41:42 +07:00
|
|
|
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$parameters = $containerConfigurator->parameters();
|
|
|
|
|
|
|
|
// paths to refactor; solid alternative to CLI arguments
|
|
|
|
$parameters->set(Option::PATHS, [__DIR__ . '/app', __DIR__ . '/system']);
|
|
|
|
|
|
|
|
// is there a file you need to skip?
|
2021-01-05 22:16:43 +07:00
|
|
|
$parameters->set(Option::SKIP, [
|
2020-09-25 10:41:42 +07:00
|
|
|
__DIR__ . '/app/Views',
|
2020-09-25 10:50:30 +07:00
|
|
|
__DIR__ . '/system/Debug/Toolbar/Views/toolbar.tpl.php',
|
2020-09-26 04:45:42 +07:00
|
|
|
__DIR__ . '/system/ThirdParty',
|
2020-09-25 10:41:42 +07:00
|
|
|
]);
|
|
|
|
|
|
|
|
// Rector relies on autoload setup of your project; Composer autoload is included by default; to add more:
|
|
|
|
$parameters->set(Option::AUTOLOAD_PATHS, [
|
|
|
|
// autoload specific file
|
|
|
|
__DIR__ . '/system/Test/bootstrap.php',
|
|
|
|
]);
|
|
|
|
|
2020-10-04 00:27:56 +07:00
|
|
|
// auto import fully qualified class names
|
|
|
|
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
|
2020-10-16 10:08:54 +07:00
|
|
|
$parameters->set(Option::ENABLE_CACHE, true);
|
2021-01-08 13:40:57 +07:00
|
|
|
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73);
|
2020-10-16 10:08:54 +07:00
|
|
|
|
2020-09-25 10:41:42 +07:00
|
|
|
$services = $containerConfigurator->services();
|
2020-09-28 18:56:04 +07:00
|
|
|
$services->set(UnderscoreToCamelCaseVariableNameRector::class);
|
2020-10-02 18:47:38 +07:00
|
|
|
$services->set(SimplifyUselessVariableRector::class);
|
2020-10-03 14:44:37 +07:00
|
|
|
$services->set(RemoveAlwaysElseRector::class);
|
2020-10-23 19:19:47 +07:00
|
|
|
$services->set(PassStrictParameterToFunctionParameterRector::class);
|
2020-10-30 20:51:53 +07:00
|
|
|
$services->set(CountArrayToEmptyArrayComparisonRector::class);
|
2021-02-01 13:23:04 +07:00
|
|
|
$services->set(ForToForeachRector::class);
|
2021-02-02 02:39:20 +07:00
|
|
|
$services->set(ChangeNestedForeachIfsToEarlyContinueRector::class);
|
2020-09-25 10:41:42 +07:00
|
|
|
};
|