|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use Rector\Core\Configuration\Option; |
6 | | -use Rector\Doctrine\Set\DoctrineSetList; |
7 | | -use Rector\Php74\Rector\Property\TypedPropertyRector; |
8 | | -use Rector\Set\ValueObject\SetList; |
9 | | -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 5 | +use Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector; |
| 6 | +use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector; |
| 7 | +use Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector; |
| 8 | +use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; |
| 9 | +use Rector\CodeQuality\Rector\If_\CombineIfRector; |
| 10 | +use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; |
| 11 | +use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector; |
| 12 | +use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector; |
| 13 | +use Rector\Config\RectorConfig; |
| 14 | +use Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector; |
| 15 | +use Rector\Doctrine\Bundle230\Rector\Class_\AddAnnotationToRepositoryRector; |
| 16 | +use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; |
| 17 | +use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\AddInstanceofAssertForNullableInstanceRector; |
| 18 | +use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector; |
| 19 | +use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector; |
| 20 | +use Rector\Renaming\Rector\FuncCall\RenameFunctionRector; |
| 21 | +use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; |
| 22 | +use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; |
10 | 23 |
|
11 | | -return static function (ContainerConfigurator $containerConfigurator): void { |
12 | | - // get parameters |
13 | | - $parameters = $containerConfigurator->parameters(); |
14 | | - $parameters->set(Option::PATHS, [ |
| 24 | +// @noinspection PhpUnhandledExceptionInspection |
| 25 | +return RectorConfig::configure() |
| 26 | + ->withPaths([ |
| 27 | + __DIR__.'/public', |
| 28 | + __DIR__.'/config', |
| 29 | + __DIR__.'/migrations', |
15 | 30 | __DIR__.'/src', |
16 | 31 | __DIR__.'/tests', |
17 | | - ]); |
18 | | - $parameters->set(Option::AUTO_IMPORT_NAMES, true); |
19 | | - $parameters->set(Option::IMPORT_SHORT_CLASSES, false); |
20 | | - $parameters->set(Option::APPLY_AUTO_IMPORT_NAMES_ON_CHANGED_FILES_ONLY, true); |
21 | | - |
22 | | - // Define what rule sets will be applied |
23 | | - $containerConfigurator->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES); |
24 | | - |
25 | | - // $containerConfigurator->import(SetList::DEAD_CODE); |
26 | | - // $containerConfigurator->import(SetList::CODE_QUALITY); |
27 | | - // $containerConfigurator->import(SetList::CODING_STYLE); |
28 | | - // $containerConfigurator->import(SetList::PHP_80); |
29 | | - |
30 | | - // get services (needed for register a single rule) |
31 | | - // $services = $containerConfigurator->services(); |
32 | | - |
33 | | - // register a single rule |
34 | | - // $services->set(TypedPropertyRector::class); |
35 | | -}; |
| 32 | + ]) |
| 33 | + ->withComposerBased(doctrine: true, phpunit: true, symfony: true) |
| 34 | + ->withPreparedSets(deadCode: true, codeQuality: true, privatization: true, rectorPreset: true, phpunitCodeQuality: true, symfonyCodeQuality: true) |
| 35 | + ->withAttributesSets(all: true) |
| 36 | + ->withConfiguredRule(RenameFunctionRector::class, [ |
| 37 | + 'implode' => 'join', |
| 38 | + 'join' => 'join', |
| 39 | + ]) |
| 40 | + ->withSkip([ |
| 41 | + AddAnnotationToRepositoryRector::class, |
| 42 | + AddInstanceofAssertForNullableInstanceRector::class, |
| 43 | + AssertEmptyNullableObjectToAssertInstanceofRector::class, |
| 44 | + CombineIfRector::class, |
| 45 | + DeclareStrictTypesRector::class, |
| 46 | + DisallowedEmptyRuleFixerRector::class, |
| 47 | + ExplicitBoolCompareRector::class, |
| 48 | + FinalizeTestCaseClassRector::class, |
| 49 | + FlipTypeControlToUseExclusiveTypeRector::class, |
| 50 | + LocallyCalledStaticMethodToNonStaticRector::class, |
| 51 | + PreferPHPUnitThisCallRector::class, |
| 52 | + RemoveDeadInstanceOfRector::class, |
| 53 | + SimplifyIfElseToTernaryRector::class, |
| 54 | + SimplifyIfReturnBoolRector::class, |
| 55 | + ThrowWithPreviousExceptionRector::class, |
| 56 | + UseIdenticalOverEqualWithSameTypeRector::class, |
| 57 | + ]) |
| 58 | +; |
0 commit comments