make newly added constructor argument optional

As the PostRunEvent class is already present in Symfony since 6.4 we cannot add
new mandatory constructor arguments without breaking backwards compatibility.
This commit is contained in:
Christian Flothmann
2025-02-08 13:09:42 +01:00
parent 65679a9694
commit 2e70ee0f59
2 changed files with 2 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ class PostRunEvent
private readonly ScheduleProviderInterface $schedule,
private readonly MessageContext $messageContext,
private readonly object $message,
private readonly mixed $result,
private readonly mixed $result = null,
) {
}

View File

@@ -57,8 +57,8 @@ class DispatchSchedulerEventListenerTest extends TestCase
$listener->onMessageFailed($workerFailedEvent);
$this->assertInstanceOf(PreRunEvent::class, $secondListener->preRunEvent);
$this->assertSame('result', $secondListener->postRunEvent->getResult());
$this->assertInstanceOf(PostRunEvent::class, $secondListener->postRunEvent);
$this->assertSame('result', $secondListener->postRunEvent->getResult());
$this->assertInstanceOf(FailureEvent::class, $secondListener->failureEvent);
$this->assertEquals(new \Exception('failed'), $secondListener->failureEvent->getError());
}