Configurable
EventStringToClassConstantRector
Turns a string event name into a class constant, but only where the event dispatcher is used
-\Illuminate\Support\Facades\Event::listen('auth.login', function () {});
+\Illuminate\Support\Facades\Event::listen(\Illuminate\Auth\Events\Login::class, function () {});
Configure your rector.php:
<?php
use RectorLaravel\Rector\StaticCall\EventStringToClassConstantRector;
use Rector\Config\RectorConfig;
use Rector\Transform\ValueObject\StringToClassConstant;
return RectorConfig::configure()
->withConfiguredRule(EventStringToClassConstantRector::class, [
new StringToClassConstant('auth.login', 'Illuminate\Auth\Events\Login', 'class'),
]);