MakeDispatchFirstArgumentEventRector

Make event object a first argument of dispatch() method, event name as second

 use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

 class SomeClass
 {
     public function run(EventDispatcherInterface $eventDispatcher)
     {
-        $eventDispatcher->dispatch('event_name', new Event());
+        $eventDispatcher->dispatch(new Event(), 'event_name');
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony43\Rector\MethodCall\MakeDispatchFirstArgumentEventRector;

return RectorConfig::configure()
    ->withRules([
        MakeDispatchFirstArgumentEventRector::class,
    ]);
SETS:  symfony/* 4.3