-
Notifications
You must be signed in to change notification settings - Fork 20
/
rector.php
55 lines (41 loc) · 2.19 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
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Laravel\Set\LaravelSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$dir = getcwd();
$parameters = $containerConfigurator->parameters();
$services = $containerConfigurator->services();
$parameters->set(Option::BOOTSTRAP_FILES, [
$dir.'/rector-bootstrap.php',
]);
$parameters->set(Option::PATHS, [
$dir.'/app',
]);
$parameters->set(Option::SKIP, [
$dir.'/app/Http/Livewire',
]);
if (file_exists($neon = $dir.'/phpstan.neon')) {
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, $neon);
}
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::IMPORT_SHORT_CLASSES, true);
$parameters->set(Option::IMPORT_DOC_BLOCKS, false);
$containerConfigurator->import(LevelSetList::UP_TO_PHP_81);
$containerConfigurator->import(SetList::PRIVATIZATION);
$services->remove(\Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector::class);
$services->remove(\Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class);
$services->remove(\Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector::class);
$containerConfigurator->import(SetList::EARLY_RETURN);
$containerConfigurator->import(SetList::CODING_STYLE);
$services->remove(\Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector::class);
$services->remove(\Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class);
$services->remove(\Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class);
$services->remove(\Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector::class);
$containerConfigurator->import(LaravelSetList::LARAVEL_80);
$containerConfigurator->import(LaravelSetList::LARAVEL_CODE_QUALITY);
$containerConfigurator->import(LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL);
};