rector/config/set/laravel52.php
Tomas Votruba 0993088cda
[SymfonyPhpConfig] Use Symplify package instead + simplify set validation (#4694)
* [SymfonyPhpConfig] Use Symplify package instead

* [SymfonyPhpConfig] Drop forgotten custom-jobs Rectors

* [CI] simplify set validation

* from inline functions to Static class

* cleanup

* decouple rector.php to allow static analysis and coding standards
2020-11-26 16:44:27 +00:00

57 lines
3.0 KiB
PHP

<?php
declare(strict_types=1);
use Rector\Generic\Rector\String_\StringToClassConstantRector;
use Rector\Generic\ValueObject\StringToClassConstant;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
# see: https://laravel.com/docs/5.2/upgrade
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'Illuminate\Auth\Access\UnauthorizedException' => 'Illuminate\Auth\Access\AuthorizationException',
'Illuminate\Http\Exception\HttpResponseException' => 'Illuminate\Foundation\Validation\ValidationException',
'Illuminate\Foundation\Composer' => 'Illuminate\Support\Composer',
],
]]);
$services->set(StringToClassConstantRector::class)
->call('configure', [[
StringToClassConstantRector::STRINGS_TO_CLASS_CONSTANTS => ValueObjectInliner::inline([
new StringToClassConstant('artisan.start', 'Illuminate\Console\Events\ArtisanStarting', 'class'),
new StringToClassConstant('auth.attempting', 'Illuminate\Auth\Events\Attempting', 'class'),
new StringToClassConstant('auth.login', 'Illuminate\Auth\Events\Login', 'class'),
new StringToClassConstant('auth.logout', 'Illuminate\Auth\Events\Logout', 'class'),
new StringToClassConstant('cache.missed', 'Illuminate\Cache\Events\CacheMissed', 'class'),
new StringToClassConstant('cache.hit', 'Illuminate\Cache\Events\CacheHit', 'class'),
new StringToClassConstant('cache.write', 'Illuminate\Cache\Events\KeyWritten', 'class'),
new StringToClassConstant('cache.delete', 'Illuminate\Cache\Events\KeyForgotten', 'class'),
new StringToClassConstant('illuminate.query', 'Illuminate\Database\Events\QueryExecuted', 'class'),
new StringToClassConstant(
'illuminate.queue.before',
'Illuminate\Queue\Events\JobProcessing',
'class'
),
new StringToClassConstant(
'illuminate.queue.after',
'Illuminate\Queue\Events\JobProcessed',
'class'
),
new StringToClassConstant('illuminate.queue.failed', 'Illuminate\Queue\Events\JobFailed', 'class'),
new StringToClassConstant(
'illuminate.queue.stopping',
'Illuminate\Queue\Events\WorkerStopping',
'class'
),
new StringToClassConstant('mailer.sending', 'Illuminate\Mail\Events\MessageSending', 'class'),
new StringToClassConstant('router.matched', 'Illuminate\Routing\Events\RouteMatched', 'class'),
]),
]]);
};