2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-07-29 01:41:20 +02:00
|
|
|
use Rector\Generic\Rector\String_\StringToClassConstantRector;
|
2020-08-26 12:54:53 +02:00
|
|
|
use Rector\Generic\ValueObject\StringToClassConstant;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
2020-08-18 17:57:30 +02:00
|
|
|
use Rector\Renaming\Rector\Name\RenameClassRector;
|
2020-08-25 00:26:14 +02:00
|
|
|
use Rector\Renaming\ValueObject\MethodCallRename;
|
|
|
|
use function Rector\SymfonyPhpConfig\inline_value_objects;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
|
|
|
2020-07-18 19:00:36 +02:00
|
|
|
# see: https://laravel.com/docs/5.4/upgrade
|
|
|
|
|
2020-07-18 18:57:24 +02:00
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
|
|
|
$services->set(StringToClassConstantRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-08-26 12:54:53 +02:00
|
|
|
StringToClassConstantRector::STRINGS_TO_CLASS_CONSTANTS => inline_value_objects([
|
|
|
|
new StringToClassConstant(
|
|
|
|
'kernel.handled',
|
|
|
|
'Illuminate\Foundation\Http\Events\RequestHandled',
|
|
|
|
'class'
|
|
|
|
),
|
|
|
|
new StringToClassConstant('locale.changed', 'Illuminate\Foundation\Events\LocaleUpdated', 'class'),
|
|
|
|
new StringToClassConstant('illuminate.log', 'Illuminate\Log\Events\MessageLogged', 'class'),
|
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(RenameClassRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-07-30 01:39:41 +02:00
|
|
|
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
2020-07-30 00:43:06 +02:00
|
|
|
'Illuminate\Console\AppNamespaceDetectorTrait' => 'Illuminate\Console\DetectsApplicationNamespace',
|
|
|
|
'Illuminate\Http\Exception\HttpResponseException' => 'Illuminate\Http\Exceptions\HttpResponseException',
|
|
|
|
'Illuminate\Http\Exception\PostTooLargeException' => 'Illuminate\Http\Exceptions\PostTooLargeException',
|
|
|
|
'Illuminate\Foundation\Http\Middleware\VerifyPostSize' => 'Illuminate\Foundation\Http\Middleware\ValidatePostSize',
|
|
|
|
'Symfony\Component\HttpFoundation\Session\SessionInterface' => 'Illuminate\Contracts\Session\Session',
|
|
|
|
],
|
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(RenameMethodRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-08-25 00:37:12 +02:00
|
|
|
RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([
|
2020-08-25 00:26:14 +02:00
|
|
|
new MethodCallRename('Illuminate\Support\Collection', 'every', 'nth'),
|
|
|
|
new MethodCallRename(
|
|
|
|
'Illuminate\Database\Eloquent\Relations\BelongsToMany',
|
|
|
|
'setJoin',
|
|
|
|
'performJoin'
|
|
|
|
),
|
|
|
|
new MethodCallRename(
|
|
|
|
'Illuminate\Database\Eloquent\Relations\BelongsToMany',
|
|
|
|
'getRelatedIds',
|
|
|
|
'allRelatedIds'
|
|
|
|
),
|
|
|
|
new MethodCallRename('Illuminate\Routing\Router', 'middleware', 'aliasMiddleware'),
|
|
|
|
new MethodCallRename('Illuminate\Routing\Route', 'getPath', 'uri'),
|
|
|
|
new MethodCallRename('Illuminate\Routing\Route', 'getUri', 'uri'),
|
|
|
|
new MethodCallRename('Illuminate\Routing\Route', 'getMethods', 'methods'),
|
|
|
|
new MethodCallRename('Illuminate\Routing\Route', 'getParameter', 'parameter'),
|
|
|
|
new MethodCallRename('Illuminate\Contracts\Session\Session', 'set', 'put'),
|
|
|
|
new MethodCallRename('Illuminate\Contracts\Session\Session', 'getToken', 'token'),
|
|
|
|
new MethodCallRename('Illuminate\Support\Facades\Request', 'setSession', 'setLaravelSession'),
|
|
|
|
new MethodCallRename('Illuminate\Http\Request', 'setSession', 'setLaravelSession'),
|
|
|
|
new MethodCallRename('Illuminate\Routing\UrlGenerator', 'forceSchema', 'forceScheme'),
|
|
|
|
new MethodCallRename('Illuminate\Validation\Validator', 'addError', 'addFailure'),
|
|
|
|
new MethodCallRename('Illuminate\Validation\Validator', 'doReplacements', 'makeReplacements'),
|
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
};
|