55 lines
2.1 KiB
PHP
55 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Rector\Core\Configuration\Option;
|
|
use Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector;
|
|
use Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector;
|
|
use Rector\DowngradePhp80\Rector\ClassConstFetch\DowngradeClassOnObjectToGetClassRector;
|
|
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRector;
|
|
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
|
|
use Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector;
|
|
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector;
|
|
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
|
|
use Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector;
|
|
use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
|
|
use Rector\Generics\Rector\Class_\GenericsPHPStormMethodAnnotationRector;
|
|
use Rector\Set\ValueObject\SetList;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
// get parameters
|
|
// $parameters = $containerConfigurator->parameters();
|
|
//
|
|
// // Define what rule sets will be applied
|
|
// $parameters->set(Option::SETS, [
|
|
// SetList::DEAD_CODE,
|
|
// SetList::PHP_80,
|
|
// ]);
|
|
|
|
// get services (needed for register a single rule)
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
|
$rules = [
|
|
// PHP8 downgrade
|
|
DowngradeClassOnObjectToGetClassRector::class,
|
|
DowngradeMatchToSwitchRector::class,
|
|
DowngradeMixedTypeDeclarationRector::class,
|
|
DowngradeNonCapturingCatchesRector::class,
|
|
DowngradeNullsafeToTernaryOperatorRector::class,
|
|
DowngradePropertyPromotionRector::class,
|
|
DowngradeStaticTypeDeclarationRector::class,
|
|
DowngradeTrailingCommasInParamUseRector::class,
|
|
DowngradeUnionTypeDeclarationRector::class,
|
|
DowngradeUnionTypeTypedPropertyRector::class,
|
|
|
|
GenericsPHPStormMethodAnnotationRector::class,
|
|
];
|
|
|
|
foreach ($rules as $rule)
|
|
{
|
|
$services->set($rule);
|
|
}
|
|
};
|