8000 [Scheduler] Make some properties readonly · symfony/symfony@bdb5e81 · GitHub
[go: up one dir, main page]

Skip to content

Commit bdb5e81

Browse files
committed
[Scheduler] Make some properties readonly
1 parent aadd302 commit bdb5e81

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/Symfony/Component/Scheduler/Generator/MessageGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ final class MessageGenerator implements MessageGeneratorInterface
2626
private CheckpointInterface $checkpoint;
2727

2828
public function __construct(
29-
private Schedule $schedule,
29+
private readonly Schedule $schedule,
3030
string|CheckpointInterface $checkpoint,
31-
private ClockInterface $clock = new Clock(),
31+
private readonly ClockInterface $clock = new Clock(),
3232
) {
3333
$this->waitUntil = new \DateTimeImmutable('@0');
3434
if (\is_string($checkpoint)) {

src/Symfony/Component/Scheduler/Scheduler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ final class Scheduler
3131
* @param iterable<Schedule> $schedules
3232
*/
3333
public function __construct(
34-
private array $handlers,
34+
private readonly array $handlers,
3535
array $schedules,
36-
private ClockInterface $clock = new Clock(),
36+
private readonly ClockInterface $clock = new Clock(),
3737
) {
3838
foreach ($schedules as $schedule) {
3939
$this->addSchedule($schedule);

src/Symfony/Component/Scheduler/Tests/Generator/CheckpointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testWithCacheSave()
105105
{
106106
$checkpoint = new Checkpoint('cache', new NoLock(), $cache = new ArrayAdapter());
107107
$now = new \DateTimeImmutable('2020-02-20 20:20:20Z');
108-
$checkpoint->acquire($n = $now->modify('-1 hour'));
108+
$checkpoint->acquire($now->modify('-1 hour'));
109109
$checkpoint->save($now, 3);
110110

111111
$this->assertSame($now, $checkpoint->time());

src/Symfony/Component/Scheduler/Tests/Messenger/SchedulerTransportFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function makeTransportFactoryWithStubs(): SchedulerTransportFactory
105105
class SomeScheduleProvider implements ScheduleProviderInterface
106106
{
107107
public function __construct(
108-
private array $messages,
108+
private readonly array $messages,
109109
) {
110110
}
111111

src/Symfony/Component/Scheduler/Trigger/CronExpressionTrigger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
final class CronExpressionTrigger implements TriggerInterface
2525
{
2626
public function __construct(
27-
private CronExpression $expression = new CronExpression('* * * * *'),
27+
private readonly CronExpression $expression = new CronExpression('* * * * *'),
2828
) {
2929
}
3030

src/Symfony/Component/Scheduler/Trigger/DatePeriodTrigger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class DatePeriodTrigger implements TriggerInterface
1818
{
1919
public function __construct(
20-
private \DatePeriod $period,
20+
private readonly \DatePeriod $period,
2121
) {
2222
}
2323

0 commit comments

Comments
 (0)
0