Skip to content

Commit 67707f6

Browse files
committed
[Scheduler] make CronExpressionTrigger "stringable"
1 parent 8b8a68e commit 67707f6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221

222222
->set('console.command.scheduler_debug', SchedulerDebugCommand::class)
223223
->args([
224-
tagged_locator('scheduler.schedule_provider', 'name')
224+
tagged_locator('scheduler.schedule_provider', 'name'),
225225
])
226226
->tag('console.command')
227227

src/Symfony/Component/Scheduler/Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
use Symfony\Component\Console\Output\OutputInterface;
1919
use Symfony\Component\Console\Style\SymfonyStyle;
2020
use Symfony\Component\Scheduler\RecurringMessage;
21-
use Symfony\Component\Scheduler\Schedule;
2221
use Symfony\Component\Scheduler\ScheduleProviderInterface;
2322
use Symfony\Contracts\Service\ServiceProviderInterface;
23+
2424
use function Symfony\Component\Clock\now;
2525

2626
/**

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@
2121
*
2222
* @experimental
2323
*/
24-
final class CronExpressionTrigger implements TriggerInterface
24+
final class CronExpressionTrigger implements TriggerInterface, \Stringable
2525
{
2626
public function __construct(
2727
private CronExpression $expression = new CronExpression('* * * * *'),
2828
) {
2929
}
3030

31+
public function __toString(): string
32+
{
33+
return "cron: {$this->expression->getExpression()}";
34+
}
35+
3136
public static function fromSpec(string $expression = '* * * * *'): self
3237
{
3338
if (!class_exists(CronExpression::class)) {

0 commit comments

Comments
 (0)