-
Notifications
You must be signed in to change notification settings - Fork 9
/
rector.php
75 lines (62 loc) · 2.57 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
<?php
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\Config\RectorConfig;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use RectorLaravel\Rector\FuncCall\RemoveDumpDataDeadCodeRector;
use RectorLaravel\Rector\PropertyFetch\OptionalToNullsafeOperatorRector;
use RectorLaravel\Set\LaravelSetList;
return static function (RectorConfig $rectorConfig): void {
// register paths
//----------------------------------------------------------
$rectorConfig->paths([
__DIR__.'/src',
]);
$rectorConfig->parallel(
processTimeout: 360,
maxNumberOfProcess: 16,
jobSize: 20
);
$rectorConfig->importNames();
// cache settings
//----------------------------------------------------------
// Ensure file system caching is used instead of in-memory.
$rectorConfig->cacheClass(FileCacheStorage::class);
// Specify a path that works locally as well as on CI job runners.
$rectorConfig->cacheDirectory(__DIR__.'/.rector_cache');
// skip paths and/or rules
//----------------------------------------------------------
$rectorConfig->skip([
// Rector transforms $foo++ into ++$foo
// and behind Pint transforms ++$foo into $foo++;
// so I deactivate, leaving priority to Pint for the moment
PostIncDecToPreIncDecRector::class,
// Transforme des faux-positifs, je préfère désactiver ça (PHP 8.1)
//NullToStrictStringFuncCallArgRector::class,
// Personally I find reading is more difficult with this syntax, so I disable
ArraySpreadInsteadOfArrayMergeRector::class,
// Do not change closure and Arrow Function to Static
StaticClosureRector::class,
StaticArrowFunctionRector::class,
]);
$rectorConfig->rules([
OptionalToNullsafeOperatorRector::class,
RemoveDumpDataDeadCodeRector::class,
]);
$rectorConfig->sets([
LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES,
LevelSetList::UP_TO_PHP_82,
SetList::PHP_82,
SetList::DEAD_CODE,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
]);
};