-
Notifications
You must be signed in to change notification settings - Fork 20
/
rector.php
63 lines (54 loc) · 2.07 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
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\FOSRestSetList;
use Rector\Symfony\Set\SensiolabsSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/test',
]);
$rectorConfig->phpVersion(PhpVersion::PHP_84);
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_84,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::STRICT_BOOLEANS,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
FOSRestSetList::ANNOTATIONS_TO_ATTRIBUTES,
SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
SetList::TYPE_DECLARATION, // https://getrector.com/blog/new-in-rector-015-complete-safe-and-known-type-declarations
]);
$rectorConfig->rules([
CountArrayToEmptyArrayComparisonRector::class,
LongArrayToShortArrayRector::class,
RenameVariableToMatchMethodCallReturnTypeRector::class,
SymplifyQuoteEscapeRector::class,
ExceptionHandlerTypehintRector::class
]);
$rectorConfig->importNames();
$rectorConfig->autoloadPaths([
__DIR__ . '/vendor/autoload.php',
]);
$rectorConfig->skip([
ChangeSwitchToMatchRector::class => [
__DIR__ . '/src/Type/Type.php',
],
]);
$rectorConfig->parallel();
};