Skip to content

Commit 6716e88

Browse files
committed
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.
1 parent 9319a0c commit 6716e88

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Scheduler/Event/PostRunEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(
2020
private readonly ScheduleProviderInterface $schedule,
2121
private readonly MessageContext $messageContext,
2222
private readonly object $message,
23-
private readonly mixed $result,
23+
private readonly mixed $result = null,
2424
) {
2525
}
2626

src/Symfony/Component/Scheduler/Tests/EventListener/DispatchSchedulerEventListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public function testDispatchSchedulerEvents()
5757
$listener->onMessageFailed($workerFailedEvent);
5858

5959
$this->assertInstanceOf(PreRunEvent::class, $secondListener->preRunEvent);
60-
$this->assertSame('result', $secondListener->postRunEvent->getResult());
6160
$this->assertInstanceOf(PostRunEvent::class, $secondListener->postRunEvent);
61+
$this->assertSame('result', $secondListener->postRunEvent->getResult());
6262
$this->assertInstanceOf(FailureEvent::class, $secondListener->failureEvent);
6363
$this->assertEquals(new \Exception('failed'), $secondListener->failureEvent->getError());
6464
}

0 commit comments

Comments
 (0)