-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
65 lines (56 loc) · 2.27 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
<?php
declare(strict_types=1);
/**
* This file is part of Cloud-Admin project.
*
* @link https://www.cloud-admin.jayjay.cn
* @document https://wiki.cloud-admin.jayjay.cn
* @license https://github.com/swow-cloud/swow-admin/blob/master/LICENSE
*/
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Set\ValueObject\LevelSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames(true, false);
$rectorConfig->paths([
__DIR__ . '/app',
__DIR__ . '/config',
__DIR__ . '/cloud-admin',
]);
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_83,
]);
// register a single rule
// $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
// define sets of rules
// $rectorConfig->sets([
// LevelSetList::UP_TO_PHP_80,
// ]);
$rectorConfig
->ruleWithConfiguration(RenameClassRector::class, [
'Hyperf\Utils\ApplicationContext' => 'Hyperf\Context\ApplicationContext',
'Hyperf\Utils\Arr' => 'Hyperf\Collection\Arr',
'Hyperf\Utils\Collection' => 'Hyperf\Collection\Collection',
'Hyperf\Utils\Coroutine' => 'Hyperf\Coroutine\Coroutine',
'Hyperf\Utils\Coroutine\Concurrent' => 'Hyperf\Coroutine\Concurrent',
'Hyperf\Utils\Str' => 'Hyperf\Stringable\Str',
'Hyperf\Utils\Stringable' => 'Hyperf\Stringable\Stringable',
]);
$rectorConfig
->ruleWithConfiguration(RenameFunctionRector::class, [
'collect' => 'Hyperf\Collection\collect',
'data_fill' => 'Hyperf\Collection\data_fill',
'data_get' => 'Hyperf\Collection\data_get',
'data_set' => 'Hyperf\Collection\data_set',
'value' => 'Hyperf\Collection\value',
'tap' => 'Hyperf\Tappable\tap',
'co' => 'Hyperf\Coroutine\co',
'defer' => 'Hyperf\Coroutine\defer',
'go' => 'Hyperf\Coroutine\go',
'parallel' => 'Hyperf\Coroutine\parallel',
'run' => 'Hyperf\Coroutine\run',
'wait' => 'Hyperf\Coroutine\wait',
]);
};