|
1 | 1 | <?php declare(strict_types=1);
|
2 | 2 |
|
3 |
| -use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector; |
4 |
| -use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector; |
5 |
| -use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector; |
6 |
| -use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector; |
7 |
| -use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; |
8 |
| -use Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector; |
9 |
| -use Rector\CodeQuality\Rector\Switch_\SwitchTrueToIfRector; |
10 |
| -use Rector\Config\RectorConfig; |
11 |
| -use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector; |
12 |
| -use Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector; |
13 |
| -use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector; |
14 |
| -use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector; |
15 |
| -use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector; |
16 |
| -use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; |
17 |
| -use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEqualsToSameRector; |
18 |
| -use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector; |
19 |
| -use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertPropertyExistsRector; |
20 |
| -use Rector\PHPUnit\PHPUnit60\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector; |
21 |
| -use Rector\PHPUnit\Set\PHPUnitSetList; |
22 |
| -use Rector\Set\ValueObject\SetList; |
23 |
| - |
24 |
| -return static function (RectorConfig $rectorConfig): void { |
| 3 | +return static function (Rector\Config\RectorConfig $rectorConfig): void { |
25 | 4 | $rectorConfig->sets([
|
26 |
| - SetList::CODE_QUALITY, |
27 |
| - SetList::DEAD_CODE, |
28 |
| - PHPUnitSetList::PHPUNIT_60, |
29 |
| - PHPUnitSetList::PHPUNIT_70, |
30 |
| - PHPUnitSetList::PHPUNIT_80, |
31 |
| - PHPUnitSetList::PHPUNIT_90, |
32 |
| - PHPUnitSetList::PHPUNIT_CODE_QUALITY, |
| 5 | + Rector\Set\ValueObject\SetList::CODE_QUALITY, |
| 6 | + Rector\Set\ValueObject\SetList::DEAD_CODE, |
| 7 | + Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_60, |
| 8 | + Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_70, |
| 9 | + Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_80, |
| 10 | + Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90, |
| 11 | + Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_CODE_QUALITY, |
33 | 12 | ]);
|
34 | 13 | $rectorConfig->skip([
|
35 |
| - AddSeeTestAnnotationRector::class, // We do not bundle tests, so referring to them is confusing for library users |
36 |
| - PreferPHPUnitThisCallRector::class, // Prefer self:: |
37 |
| - AddDoesNotPerformAssertionToNonAssertingTestRector::class, // False-positive |
38 |
| - CallableThisArrayToAnonymousFunctionRector::class, // Callable in array form is shorter and more efficient |
39 |
| - IssetOnPropertyObjectToPropertyExistsRector::class, // isset() is nice when moving towards typed properties |
40 |
| - FlipTypeControlToUseExclusiveTypeRector::class, // Unnecessarily complex with PHPStan |
41 |
| - JoinStringConcatRector::class => [ |
42 |
| - __DIR__ . '/tests', |
| 14 | + Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector::class, // Prefer self:: |
| 15 | + Rector\PHPUnit\PHPUnit60\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector::class, // False-positive |
| 16 | + Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector::class, // isset() is nice when moving towards typed properties |
| 17 | + Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector::class, // Unnecessarily complex with PHPStan |
| 18 | + Rector\CodeQuality\Rector\Concat\JoinStringConcatRector::class => [ |
| 19 | + __DIR__ . '/tests', // Sometimes more readable for long strings |
43 | 20 | ],
|
44 |
| - LocallyCalledStaticMethodToNonStaticRector::class, // static methods are fine |
45 |
| - UnusedForeachValueToArrayKeysRector::class, // Less efficient |
46 |
| - RemoveAlwaysTrueIfConditionRector::class, // Sometimes necessary to prove runtime behaviour matches defined types |
47 |
| - RemoveDeadInstanceOfRector::class, // Sometimes necessary to prove runtime behaviour matches defined types |
48 |
| - RemoveNonExistingVarAnnotationRector::class, // Sometimes false-positive |
49 |
| - RemoveUnusedPrivatePropertyRector::class, // TODO reintroduce when https://github.com/rectorphp/rector-src/pull/4491 is released |
50 |
| - AssertPropertyExistsRector::class, // Uses deprecated PHPUnit methods |
51 |
| - AssertIssetToSpecificMethodRector::class => [ |
| 21 | + Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector::class, // static methods are fine |
| 22 | + Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector::class, // Less efficient |
| 23 | + Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector::class, // Sometimes necessary to prove runtime behaviour matches defined types |
| 24 | + Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector::class, // Sometimes necessary to prove runtime behaviour matches defined types |
| 25 | + Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class, // Sometimes false-positive |
| 26 | + Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector::class, // TODO reintroduce when https://github.com/rectorphp/rector-src/pull/4491 is released |
| 27 | + Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertPropertyExistsRector::class, // Uses deprecated PHPUnit methods |
| 28 | + Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector::class => [ |
52 | 29 | __DIR__ . '/tests/Utils/MixedStoreTest.php', // Uses keys that are not string or int
|
53 | 30 | ],
|
54 |
| - AssertEqualsToSameRector::class => [ |
| 31 | + Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEqualsToSameRector::class => [ |
55 | 32 | __DIR__ . '/tests/TestCaseBase.php', // Array output may differ between tested PHP versions, assertEquals smooths over this
|
56 | 33 | ],
|
57 |
| - SwitchTrueToIfRector::class, // More expressive in some cases |
| 34 | + Rector\CodeQuality\Rector\Switch_\SwitchTrueToIfRector::class, // More expressive in some cases |
58 | 35 | ]);
|
59 | 36 | $rectorConfig->paths([
|
| 37 | + __DIR__ . '/benchmarks', |
60 | 38 | __DIR__ . '/examples',
|
61 | 39 | __DIR__ . '/phpstan',
|
62 | 40 | __DIR__ . '/src',
|
|
0 commit comments