Skip to content

Commit 3810053

Browse files
committed
declare constructor argument as optional for backwards compatibility
1 parent 6637b78 commit 3810053

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/Messenger/Exception/DelayedMessageHandlingException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
class DelayedMessageHandlingException extends RuntimeException
2323
{
2424
private array $exceptions;
25-
private Envelope $envelope;
25+
private ?Envelope $envelope;
2626

27-
public function __construct(array $exceptions, Envelope $envelope)
27+
public function __construct(array $exceptions, Envelope $envelope = null)
2828
{
2929
$this->envelope = $envelope;
3030

@@ -49,7 +49,7 @@ public function getExceptions(): array
4949
return $this->exceptions;
5050
}
5151

52-
public function getEnvelope(): Envelope
52+
public function getEnvelope(): ?Envelope
5353
{
5454
return $this->envelope;
5555
}

src/Symfony/Component/Messenger/Worker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private function ack(): bool
187187
$receiver->reject($envelope);
188188
}
189189

190-
if ($e instanceof HandlerFailedException || $e instanceof DelayedMessageHandlingException) {
190+
if ($e instanceof HandlerFailedException || ($e instanceof DelayedMessageHandlingException && null !== $e->getEnvelope())) {
191191
$envelope = $e->getEnvelope();
192192
}
193193

0 commit comments

Comments
 (0)