ReplaceLifecycleEventArgsByDedicatedEventArgsRector

Replace Doctrine\ORM\Event\LifecycleEventArgs with specific event classes based on the function call

-use Doctrine\ORM\Event\LifecycleEventArgs;
+use Doctrine\ORM\Event\PrePersistEventArgs;

 class PrePersistExample
 {
-    public function prePersist(LifecycleEventArgs $args)
+    public function prePersist(PrePersistEventArgs $args)
     {
         // ...
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Doctrine\Orm214\Rector\Param\ReplaceLifecycleEventArgsByDedicatedEventArgsRector;

return RectorConfig::configure()
    ->withRules([
        ReplaceLifecycleEventArgsByDedicatedEventArgsRector::class,
    ]);