-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
68 lines (65 loc) · 2.73 KB
/
Copy pathrector.php
File metadata and controls
68 lines (65 loc) · 2.73 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
<?php
declare(strict_types=1);
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\ReplaceTestAnnotationWithPrefixedFunctionRector;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\ReplaceTestFunctionPrefixWithAttributeRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
//@see https://github.com/rectorphp/rector/blob/master/docs/how_to_ignore_rule_or_paths.md
return static function(RectorConfig $rectorConfig): void {
$rectorConfig->noDiffs();
$rectorConfig->cacheDirectory(__DIR__.'/storage/tmp/rector');
//$rectorConfig->autoloadPaths(['vendor/autoload.php']);
$rectorConfig->importNames(true, false);
$rectorConfig->importShortClasses(false);
$rectorConfig->removeUnusedImports(true);
$rectorConfig->memoryLimit('-1');
$rectorConfig->indent(' ', 4);
// paths to refactor; solid alternative to CLI arguments
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/config',
__DIR__.'/tests',
]);
$rectorConfig->parallel(720);
// here we can define, what sets of rules will be applied
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::EARLY_RETURN,
SetList::DEAD_CODE,
SetList::INSTANCEOF,
SetList::TYPE_DECLARATION,
SetList::CARBON,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_100,
]);
$rectorConfig->rules([
ReplaceTestFunctionPrefixWithAttributeRector::class,
]);
//exclude some rectors or files
$rectorConfig->skip([
ArgumentAdderRector::class,
CompactToVariablesRector::class,
StaticCallOnNonStaticToInstanceCallRector::class,
FirstClassCallableRector::class,
ReplaceTestAnnotationWithPrefixedFunctionRector::class,
IssetOnPropertyObjectToPropertyExistsRector::class,
DisallowedEmptyRuleFixerRector::class,
CountArrayToEmptyArrayComparisonRector::class,
ExplicitBoolCompareRector::class,
//directory
__DIR__.'/tests/Dummies',
]);
};