-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrector.php
117 lines (103 loc) · 4.15 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* This file is part of the guanguans/laravel-proxy-manager.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector;
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\Config\RectorConfig;
use Rector\Configuration\Option;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->bootstrapFiles([
// __DIR__.'/vendor/autoload.php',
]);
$rectorConfig->autoloadPaths([
// __DIR__.'/vendor/autoload.php',
]);
$rectorConfig->paths([
__DIR__.'/config',
__DIR__.'/src',
__DIR__.'/tests',
__DIR__.'/.php-cs-fixer.php',
__DIR__.'/rector.php',
]);
$rectorConfig->skip([
// rules
CallableThisArrayToAnonymousFunctionRector::class,
InlineIfToExplicitIfRector::class,
LogicalToBooleanRector::class,
SimplifyBoolIdenticalTrueRector::class,
ChangeAndIfToEarlyReturnRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
EncapsedStringsToSprintfRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
// optional rules
// AddDefaultValueForUndefinedVariableRector::class,
// RemoveUnusedVariableAssignRector::class,
// UnSpreadOperatorRector::class,
// ConsistentPregDelimiterRector::class,
StaticClosureRector::class,
// paths
'**/Fixture*',
'**/Fixture/*',
'**/Source*',
'**/Source/*',
'**/Expected/*',
'**/Expected*',
__DIR__.'/tests/stub',
// __DIR__.'/src/Commands/ClearGeneratedProxyClassesCommand.php',
// __DIR__.'/src/Commands/ListGeneratedProxyClassesCommand.php',
// __DIR__.'/src/ProxyManagerServiceProvider.php',
]);
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
// SetList::GMAGICK_TO_IMAGICK,
// SetList::MONOLOG_20,
// SetList::MYSQL_TO_MYSQLI,
SetList::NAMING,
// SetList::PRIVATIZATION,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
// LaravelLevelSetList::UP_TO_LARAVEL_70,
// LaravelSetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
// LaravelSetList::LARAVEL_STATIC_TO_INJECTION,
// LaravelSetList::LARAVEL_CODE_QUALITY,
// LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL,
// LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES,
// PHPUnitSetList::PHPUNIT80_DMS,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);
// $rectorConfig->disableParallel();
$rectorConfig->importNames(false, false);
// $rectorConfig->cacheClass(FileCacheStorage::class);
// $rectorConfig->cacheDirectory(__DIR__.'/build/rector');
// $rectorConfig->fileExtensions(['php']);
// $rectorConfig->phpstanConfig(__DIR__.'/phpstan.neon');
// $rectorConfig->parameters()->set(Option::APPLY_AUTO_IMPORT_NAMES_ON_CHANGED_FILES_ONLY, true);
// $rectorConfig->phpVersion(PhpVersion::PHP_80);
// $rectorConfig->parallel();
// $rectorConfig->indent(' ', 4);
$rectorConfig->rules([
InlineConstructorDefaultToPropertyRector::class,
]);
};