-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
80 lines (78 loc) · 3.41 KB
/
Copy pathrector.php
File metadata and controls
80 lines (78 loc) · 3.41 KB
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
<?php declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Carbon\Rector\FuncCall\TimeFuncCallToCarbonRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use RectorLaravel\Set\LaravelSetList;
use RectorPest\Set\PestSetList;
return RectorConfig::configure()
->withCache(
cacheDirectory: './.cache/rector',
cacheClass: FileCacheStorage::class,
)
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/workbench',
])
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
typeDeclarationDocblocks: true,
privatization: true,
instanceOf: true,
earlyReturn: true,
carbon: true,
rectorPreset: true,
phpunitCodeQuality: true,
)
->withAttributesSets()
->withImportNames()
->withFluentCallNewLine()
->withParallel(300, 15, 15)
->withMemoryLimit('3G')
->withPhpSets(php84: true)
->withSets(array_merge(
[
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL,
LaravelSetList::LARAVEL_CONTAINER_STRING_TO_FULLY_QUALIFIED_NAME,
LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES,
],
class_exists(PestSetList::class) ? [
PestSetList::PEST_CODE_QUALITY,
PestSetList::PEST_CHAIN,
PestSetList::PEST_LARAVEL,
] : [],
))
->withSkip([
NullToStrictStringFuncCallArgRector::class,
AddArrowFunctionReturnTypeRector::class,
ExplicitBoolCompareRector::class,
InlineArrayReturnAssignRector::class,
PrivatizeFinalClassMethodRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
// Class-name strings are analysis *data* here — tests build PHP source as strings, and src
// matches namespace prefixes. Converting them to ::class constants drops the leading
// backslash of rooted names and changes what the parser sees.
StringClassNameToClassConstantRector::class,
UseClassKeywordForClassNameResolutionRector::class,
// The fixture project is verbatim input for Laravel Brain and the tracers — "improving" it
// changes what the tests analyze (Rector removed the fixture Kernel's alias map as dead code).
__DIR__ . '/tests/Fixtures',
// GraphCache's racy-clean guard must compare file mtimes/ctimes to the real wall clock;
// Date::now() is fakeable (Carbon::setTestNow), which a host app could freeze and silently
// disable the guard. Keep the raw time() call there.
TimeFuncCallToCarbonRector::class => [__DIR__ . '/src/Graph/GraphCache.php'],
]);