-
Notifications
You must be signed in to change notification settings - Fork 19
/
rector.php
77 lines (65 loc) · 2.7 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
<?php
declare(strict_types=1);
use PhpParser\Node\Scalar\EncapsedStringPart;
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
use Rector\CodingStyle\Rector\Property\AddFalseDefaultToBoolPropertyRector;
use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
//$parameters->set(Option::OPTION_DRY_RUN,true);
$parameters->set(Option::SETS, [
SetList::CODE_QUALITY
]);
/*
SetList::CODING_STYLE,
SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION,
SetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
SetList::PHP_53,
SetList::PHP_54,
SetList::PHP_56,
SetList::PHP_70,
SetList::PHP_71,
SetList::PHP_72,
SetList::PHPUNIT_CODE_QUALITY,
]);*/
//
$parameters->set(Option::SKIP, [
VersionCompareFuncCallToConstantRector::class=>[ __DIR__ . '/src',],
BinarySwitchToIfElseRector::class=>[ __DIR__ . '/src',],
StaticCallOnNonStaticToInstanceCallRector::class=>[
__DIR__ . '/src',
],
AddFalseDefaultToBoolPropertyRector::class => [
// single file
__DIR__ . '/src/classes/Connection.php',
// or directory
__DIR__ . '/src/database/databasetraits/HasTrait.php'
]
]);
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon');
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_74);
$parameters->set(Option::ENABLE_CACHE, true);
$parameters->set(Option::CACHE_DIR, __DIR__ . '/.build/rector');
$parameters->set(Option::PATHS, [
//__DIR__ . '/src/translations',
//__DIR__ . '/src',
__DIR__ . '/src/controllers',
__DIR__ . '/src/database',
__DIR__ . '/src/decorators',
__DIR__ . '/src/middleware',
__DIR__ . '/src/classes',
//__DIR__ . '/tests'
]);
// register single rule
$services = $containerConfigurator->services();
$services->set(EncapsedStringsToSprintfRector::class);
$services->set(JoinStringConcatRector::class);
};