mirror of
https://github.com/symfony/scheduler.git
synced 2026-03-24 00:02:18 +01:00
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:
@@ -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,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user