-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
65 lines (59 loc) · 2.62 KB
/
Copy pathrector.php
File metadata and controls
65 lines (59 loc) · 2.62 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
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector;
use RectorLaravel\Rector\ClassMethod\MigrateToSimplifiedAttributeRector;
use RectorLaravel\Set\LaravelLevelSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/app',
__DIR__.'/bootstrap',
__DIR__.'/config',
__DIR__.'/database',
__DIR__.'/public',
__DIR__.'/resources',
__DIR__.'/routes',
__DIR__.'/tests',
]);
// Register sets for PHP version upgrade
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_84,
SetList::DEAD_CODE,
SetList::CODE_QUALITY,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,
// WITHOUT_ATTRIBUTES: skips rewriting Eloquent scopes/casts to PHP
// attributes — adopt that deliberately, not as a side effect
LaravelLevelSetList::UP_TO_LARAVEL_130_WITHOUT_ATTRIBUTES,
]);
// Enforces declare(strict_types=1); at the top of all files
$rectorConfig->rule(SafeDeclareStrictTypesRector::class);
$rectorConfig->skip([
'**/vendor/**',
// Generated by package discovery; contents vary per environment
__DIR__.'/bootstrap/cache',
// strtolower(...) narrows the callable to string params, which fails
// phpstan max against the untyped sensitiveInputs() convention method
FunctionFirstClassCallableRector::class => [
__DIR__.'/app/Providers/AppServiceProvider.php',
],
// Would re-type $traitObject as bare `object`, losing the
// anonymous-class type phpstan infers from the setUp assignment
TypedPropertyFromStrictSetUpRector::class => [
__DIR__.'/tests/Unit/Traits/HasWebhookSensitiveDataTest.php',
],
TypedPropertyFromAssignsRector::class => [
__DIR__.'/tests/Unit/Traits/HasWebhookSensitiveDataTest.php',
],
// Migrating get*Attribute() accessors to Attribute::make() drops the
// return types larastan uses to type the magic properties (~105 new
// phpstan errors). Legacy accessors remain fully supported; migrate
// deliberately with typed closures if ever wanted.
MigrateToSimplifiedAttributeRector::class,
]);
};