|
12 | 12 | use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
|
13 | 13 | use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
|
14 | 14 | use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
|
15 |
| -use Rector\TypeDeclaration\Rector\Property\AddPropertyTypeDeclarationRector; |
16 | 15 | use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
|
17 | 16 | use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
|
18 | 17 | use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
|
19 | 18 | use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
|
| 19 | +use Rector\ValueObject\PhpVersion; |
20 | 20 |
|
21 |
| -return RectorConfig::configure() |
22 |
| - ->withPaths([ |
23 |
| - __DIR__ . '/src', |
24 |
| - __DIR__ . '/tests', |
25 |
| - ]) |
26 |
| - // uncomment to reach your current PHP version |
27 |
| - //->withPhpSets() |
28 |
| - ->withSets([ |
| 21 | +return static function (RectorConfig $rectorConfig) { |
| 22 | + $rectorConfig->paths([ |
| 23 | + __DIR__ . '/../../src', |
| 24 | + __DIR__ . '/../../tests', |
| 25 | + ]); |
| 26 | + $rectorConfig->phpVersion(PhpVersion::PHP_74); |
| 27 | + $rectorConfig->sets([ |
29 | 28 | LevelSetList::UP_TO_PHP_74,
|
30 |
| - ]) |
31 |
| - ->withRules([ |
32 |
| - AddVoidReturnTypeWhereNoReturnRector::class, |
33 |
| - TypedPropertyFromAssignsRector::class, |
34 |
| - TypedPropertyFromStrictConstructorRector::class, |
35 |
| - TypedPropertyFromStrictSetUpRector::class, |
| 29 | + ]); |
| 30 | + $rectorConfig->rules([ |
| 31 | + // Privatization |
36 | 32 | PrivatizeFinalClassMethodRector::class,
|
37 |
| - DeclareStrictTypesRector::class, |
38 |
| - ReturnTypeFromStrictTypedPropertyRector::class, |
| 33 | + |
| 34 | + // TypeDeclaration |
39 | 35 | AddMethodCallBasedStrictParamTypeRector::class,
|
40 | 36 | AddParamTypeFromPropertyTypeRector::class,
|
| 37 | + AddVoidReturnTypeWhereNoReturnRector::class, |
41 | 38 | ReturnTypeFromStrictNativeCallRector::class,
|
42 | 39 | ReturnTypeFromStrictScalarReturnExprRector::class,
|
43 |
| - ]) |
44 |
| - //->withConfiguredRule(AddPropertyTypeDeclarationRector::class, []) |
45 |
| - ->withConfiguredRule(AddParamTypeDeclarationRector::class, []) |
46 |
| - ->withImportNames(true, true, false); |
| 40 | + ReturnTypeFromStrictTypedPropertyRector::class, |
| 41 | + |
| 42 | + TypedPropertyFromAssignsRector::class, |
| 43 | + TypedPropertyFromStrictConstructorRector::class, |
| 44 | + TypedPropertyFromStrictSetUpRector::class, |
| 45 | + |
| 46 | + DeclareStrictTypesRector::class, |
| 47 | + ]); |
| 48 | + $rectorConfig->ruleWithConfiguration(AddParamTypeDeclarationRector::class, []); |
| 49 | + $rectorConfig->importNames(); |
| 50 | + $rectorConfig->importShortClasses(false); |
| 51 | +}; |
0 commit comments