8000 [Scheduler] Make some properties readonly by fancyweb · Pull Request #49799 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Scheduler] Make some properties readonly #49799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ final class MessageGenerator implements MessageGeneratorInterface
private CheckpointInterface $checkpoint;

public function __construct(
private Schedule $schedule,
private readonly Schedule $schedule,
string|CheckpointInterface $checkpoint,
private ClockInterface $clock = new Clock(),
private readonly ClockInterface $clock = new Clock(),
) {
$this->waitUntil = new \DateTimeImmutable('@0');
if (\is_string($checkpoint)) {
8000 Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Scheduler/Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ final class Scheduler
* @param iterable<Schedule> $schedules
*/
public function __construct(
private array $handlers,
private readonly array $handlers,
array $schedules,
private ClockInterface $clock = new Clock(),
private readonly ClockInterface $clock = new Clock(),
) {
foreach ($schedules as $schedule) {
$this->addSchedule($schedule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testWithCacheSave()
{
$checkpoint = new Checkpoint('cache', new NoLock(), $cache = new ArrayAdapter());
$now = new \DateTimeImmutable('2020-02-20 20:20:20Z');
$checkpoint->acquire($n = $now->modify('-1 hour'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable.

$checkpoint->acquire($now->modify('-1 hour'));
$checkpoint->save($now, 3);

$this->assertSame($now, $checkpoint->time());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private function makeTransportFactoryWithStubs(): SchedulerTransportFactory
class SomeScheduleProvider implements ScheduleProviderInterface
{
public function __construct(
private array $messages,
private readonly array $messages,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
final class CronExpressionTrigger implements TriggerInterface
{
public function __construct(
private CronExpression $expression = new CronExpression('* * * * *'),
private readonly CronExpression $expression = new CronExpression('* * * * *'),
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class DatePeriodTrigger implements TriggerInterface
{
public function __construct(
private \DatePeriod $period,
private readonly \DatePeriod $period,
) {
}

Expand Down
0