Skip to content

Commit 9ad4353

Browse files
committed
bug symfony#59731 [Scheduler] make newly added constructor argument optional (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [Scheduler] make newly added constructor argument optional | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT As the PostRunEvent class is already present in Symfony since 6.4 we cannot add new mandatory constructor arguments without breaking backwards compatibility. Commits ------- 6716e88 make newly added constructor argument optional
2 parents 9319a0c + 6716e88 commit 9ad4353

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)