forked from Payum/Payum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
85 lines (74 loc) · 3.12 KB
/
rector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
]);
$rectorConfig->importNames();
$rectorConfig->importShortClasses();
$rectorConfig->phpVersion(PhpVersion::PHP_82);
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
// PHP
SetList::PHP_72,
SetList::PHP_73,
SetList::PHP_74,
SetList::PHP_80,
// Code Quality
SetList::INSTANCEOF,
// PHPUnit
PHPUnitSetList::PHPUNIT_40,
PHPUnitSetList::PHPUNIT_50,
PHPUnitSetList::PHPUNIT_60,
PHPUnitSetList::PHPUNIT_70,
PHPUnitSetList::PHPUNIT_80,
PHPUnitSetList::PHPUNIT_90,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);
$rectorConfig->rules([
SimplifyUselessVariableRector::class,
ShortenElseIfRector::class,
SimplifyIfReturnBoolRector::class,
UnusedForeachValueToArrayKeysRector::class,
ChangeArrayPushToArrayAssignRector::class,
UnwrapSprintfOneArgumentRector::class,
FlipTypeControlToUseExclusiveTypeRector::class,
InlineConstructorDefaultToPropertyRector::class,
AddVoidReturnTypeWhereNoReturnRector::class,
Utf8DecodeEncodeToMbConvertEncodingRector::class,
]);
$rectorConfig->skip([
AddSeeTestAnnotationRector::class,
ClassPropertyAssignToConstructorPromotionRector::class,
MixedTypeRector::class,
FinalizePublicClassConstantRector::class,
ReadOnlyPropertyRector::class,
FirstClassCallableRector::class,
ReturnNeverTypeRector::class,
AddVoidReturnTypeWhereNoReturnRector::class => [
__DIR__ . '/src/Payum/Core/GatewayFactory.php',
],
]);
};