GetNestedExceptionsToGetWrappedExceptionsRector

Change HandlerFailedException getNestedExceptions() and getNestedExceptionOfClass() to array_values() of getWrappedExceptions()

 use Symfony\Component\Messenger\Exception\HandlerFailedException;

 function run(HandlerFailedException $exception)
 {
-    $exceptions = $exception->getNestedExceptions();
-    $logicExceptions = $exception->getNestedExceptionOfClass(\LogicException::class);
+    $exceptions = array_values($exception->getWrappedExceptions());
+    $logicExceptions = array_values($exception->getWrappedExceptions(\LogicException::class));
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony70\Rector\MethodCall\GetNestedExceptionsToGetWrappedExceptionsRector;

return RectorConfig::configure()
    ->withRules([
        GetNestedExceptionsToGetWrappedExceptionsRector::class,
    ]);
PACKAGE:  symfony/messenger >=6.4

Other rules in the symfony/messenger set