diff --git a/composer.json b/composer.json index 7c010e3..5f2e020 100644 --- a/composer.json +++ b/composer.json @@ -23,25 +23,25 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", - "symfony/config": "^4.4 || ^5.4 || ^6.0", - "symfony/console": "^4.4 || ^5.4 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0", - "symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0", - "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0", - "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0", - "symfony/messenger": "^4.4 || ^5.4 || ^6.0", - "symfony/stopwatch": "^4.4 || ^5.4 || ^6.0", + "symfony/config": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/console": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/messenger": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^4.4 || ^5.4 || ^6.0 || ^7.0", "symplify/easy-coding-standard": "^9.3" }, "suggest": { - "symfony/config": "^4.4 || ^5.4 || ^6.0", - "symfony/console": "^4.4 || ^5.4 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0", - "symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0", - "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0", - "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0", - "symfony/messenger": "^4.4 || ^5.4 || ^6.0", - "symfony/stopwatch": "^4.4 || ^5.4 || ^6.0" + "symfony/config": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/console": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/messenger": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^4.4 || ^5.4 || ^6.0 || ^7.0" }, "config": { "preferred-install": "dist", diff --git a/src/EventListener/MessengerProfilerListener.php b/src/EventListener/MessengerProfilerListener.php index df1b202..8c35dc6 100644 --- a/src/EventListener/MessengerProfilerListener.php +++ b/src/EventListener/MessengerProfilerListener.php @@ -49,7 +49,14 @@ public function onReject(WorkerMessageFailedEvent $event): void $throwable = $event->getThrowable(); if ($throwable instanceof HandlerFailedException) { - $nestedExceptions = $throwable->getNestedExceptions(); + $nestedExceptions = []; + + if (method_exists($throwable, 'getNestedExceptions')) { + $nestedExceptions = $throwable->getNestedExceptions(); + } elseif (method_exists($throwable, 'getWrappedExceptions')) { + $nestedExceptions = $throwable->getWrappedExceptions(); + } + $firstNestedException = reset($nestedExceptions); $throwable = false !== $firstNestedException ? $firstNestedException : $throwable;