-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrector.php
78 lines (67 loc) · 2.81 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
<?php
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
use Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector;
use Rector\Config\RectorConfig;
use Rector\CustomRules\ReplaceModelAttributesRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
use RectorLaravel\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector;
use RectorLaravel\Rector\ClassMethod\MigrateToSimplifiedAttributeRector;
use RectorLaravel\Rector\Expr\AppEnvironmentComparisonToParameterRector;
use RectorLaravel\Rector\MethodCall\EloquentWhereTypeHintClosureParameterRector;
use RectorLaravel\Rector\MethodCall\UseComponentPropertyWithinCommandsRector;
use RectorLaravel\Rector\MethodCall\ValidationRuleArrayStringValueToArrayRector;
use RectorLaravel\Set\LaravelSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/app',
__DIR__ . '/tests',
]);
$rectorConfig->rules([
// Custom
ReplaceModelAttributesRector::class,
// Laravel Rules
AddGenericReturnTypeToRelationsRector::class,
AppEnvironmentComparisonToParameterRector::class,
EloquentWhereTypeHintClosureParameterRector::class,
MigrateToSimplifiedAttributeRector::class,
UseComponentPropertyWithinCommandsRector::class,
ValidationRuleArrayStringValueToArrayRector::class,
// Rector Rules
DeclareStrictTypesRector::class,
ClassPropertyAssignToConstructorPromotionRector::class,
SeparateMultiUseImportsRector::class,
SymplifyQuoteEscapeRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
]);
$rectorConfig->sets([
SetList::NAMING,
SetList::CARBON,
SetList::DEAD_CODE,
SetList::CODE_QUALITY,
SetList::EARLY_RETURN,
SetList::PHP_80,
SetList::PHP_81,
SetList::PHP_82,
SetList::PHP_83,
SetList::PHP_84,
SetList::TYPE_DECLARATION,
SetList::INSTANCEOF,
LaravelSetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
LaravelSetList::LARAVEL_100,
LaravelSetList::LARAVEL_110,
LaravelSetList::LARAVEL_CODE_QUALITY,
]);
$rectorConfig->skip([
ReadOnlyPropertyRector::class,
// TODO - Fix the readonly changes this makes that are problematic.
]);
$rectorConfig->importNames();
$rectorConfig->cacheClass(FileCacheStorage::class);
$rectorConfig->cacheDirectory('./storage/rector/cache');
};