-
Notifications
You must be signed in to change notification settings - Fork 44
/
laravel58.php
37 lines (33 loc) · 1.79 KB
/
laravel58.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
<?php
declare(strict_types=1);
use PHPStan\Type\BooleanType;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
use Rector\Renaming\ValueObject\RenameProperty;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
use RectorLaravel\Rector\Class_\PropertyDeferToDeferrableProviderToRector;
use RectorLaravel\Rector\StaticCall\MinutesToSecondsInCacheRector;
// https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers
// https://github.com/laravel/framework/pull/26898
// see: https://laravel.com/docs/5.8/upgrade
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/laravel-array-str-functions-to-static-call.php');
$rectorConfig->rule(MinutesToSecondsInCacheRector::class);
$rectorConfig
->ruleWithConfiguration(
AddReturnTypeDeclarationRector::class,
[new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Repository', 'put', new BooleanType),
new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Repository', 'forever', new BooleanType),
new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'put', new BooleanType),
new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'putMany', new BooleanType),
new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'forever', new BooleanType),
]
);
$rectorConfig
->ruleWithConfiguration(
RenamePropertyRector::class,
[new RenameProperty('Illuminate\Routing\UrlGenerator', 'cachedSchema', 'cachedScheme')]
);
$rectorConfig->rule(PropertyDeferToDeferrableProviderToRector::class);
};