forked from relaticle/relaticle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
106 lines (103 loc) · 5.13 KB
/
Copy pathrector.php
File metadata and controls
106 lines (103 loc) · 5.13 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php85\Rector\Property\AddOverrideAttributeToOverriddenPropertiesRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use RectorLaravel\Rector\Class_\AddHasFactoryToModelsRector;
use RectorLaravel\Rector\Class_\AppendsPropertyToAppendsAttributeRector;
use RectorLaravel\Rector\Class_\BackoffPropertyToBackoffAttributeRector;
use RectorLaravel\Rector\Class_\FillablePropertyToFillableAttributeRector;
use RectorLaravel\Rector\Class_\HiddenPropertyToHiddenAttributeRector;
use RectorLaravel\Rector\Class_\TablePropertyToTableAttributeRector;
use RectorLaravel\Rector\Class_\TimeoutPropertyToTimeoutAttributeRector;
use RectorLaravel\Rector\Class_\TriesPropertyToTriesAttributeRector;
use RectorLaravel\Rector\Class_\UniqueForPropertyToUniqueForAttributeRector;
use RectorLaravel\Rector\Class_\UseForwardsCallsTraitRector;
use RectorLaravel\Rector\Empty_\EmptyToBlankAndFilledFuncRector;
use RectorLaravel\Rector\MethodCall\EloquentWhereTypeHintClosureParameterRector;
use RectorLaravel\Set\LaravelSetList;
use RectorLaravel\Set\LaravelSetProvider;
return RectorConfig::configure()
->withSetProviders(LaravelSetProvider::class)
->withComposerBased(laravel: true)
// Keep the result cache inside the project so CI can restore it between runs.
// Rector otherwise caches to the system temp dir, which GitHub Actions discards.
->withCache(cacheDirectory: __DIR__.'/.cache/rector')
->withPaths([
__DIR__.'/app',
__DIR__.'/packages',
__DIR__.'/bootstrap/app.php',
__DIR__.'/config',
__DIR__.'/database',
__DIR__.'/public',
])
->withSkip([
AddOverrideAttributeToOverriddenMethodsRector::class,
// PHP 8.5 extends #[\Override] to properties. Skipped for the same reason as
// the method rule above: it would tag every Filament $navigationIcon/$slug
// override in the codebase without adding safety we rely on.
AddOverrideAttributeToOverriddenPropertiesRector::class,
// Migrating model/job properties to their PHP-attribute equivalents and
// tightening closure typehints in Eloquent where() calls is a codebase-wide
// refactor best handled in dedicated PRs, not bundled into dependency updates.
AppendsPropertyToAppendsAttributeRector::class,
BackoffPropertyToBackoffAttributeRector::class,
FillablePropertyToFillableAttributeRector::class,
HiddenPropertyToHiddenAttributeRector::class,
TablePropertyToTableAttributeRector::class,
TimeoutPropertyToTimeoutAttributeRector::class,
TriesPropertyToTriesAttributeRector::class,
UniqueForPropertyToUniqueForAttributeRector::class,
EloquentWhereTypeHintClosureParameterRector::class,
RemoveUnusedPrivateMethodRector::class => [
// Skip Filament importer lifecycle hooks - they're called dynamically via callHook()
__DIR__.'/app/Filament/Imports/*',
],
PrivatizeFinalClassMethodRector::class => [
// Filament expects protected visibility for lifecycle hooks
__DIR__.'/app/Filament/Imports/*',
],
ArrayToFirstClassCallableRector::class => [
// class_exists has optional bool param that conflicts with Collection::first signature
__DIR__.'/app/Providers/AppServiceProvider.php',
],
ArrowFunctionDelegatingCallToFirstClassCallableRector::class => [
// class_exists has optional bool param that conflicts with Collection::first signature
__DIR__.'/app/Providers/AppServiceProvider.php',
],
AddHasFactoryToModelsRector::class => [
__DIR__.'/app/Models/PersonalAccessToken.php',
__DIR__.'/app/Models/ActivityLog/Activity.php',
__DIR__.'/app/Models/Passport/*',
__DIR__.'/packages/ImportWizard/src/Models/*',
],
])
->withSets([
LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL,
LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL,
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_COLLECTION,
LaravelSetList::LARAVEL_CONTAINER_STRING_TO_FULLY_QUALIFIED_NAME,
LaravelSetList::LARAVEL_ELOQUENT_MAGIC_METHOD_TO_QUERY_BUILDER,
LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES,
LaravelSetList::LARAVEL_FACTORIES,
LaravelSetList::LARAVEL_IF_HELPERS,
LaravelSetList::LARAVEL_TESTING,
LaravelSetList::LARAVEL_TYPE_DECLARATIONS,
])
->withRules([
EmptyToBlankAndFilledFuncRector::class,
UseForwardsCallsTraitRector::class,
])
->withPreparedSets(
deadCode: true,
codeQuality: true,
typeDeclarations: true,
privatization: true,
earlyReturn: true,
)
->withPhpSets();