8000 - · symfony/symfony@6f5ae4a · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f5ae4a

Browse files
committed
-
1 parent 33b200d commit 6f5ae4a

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ static function (ChildDefinition $definition, AsPeriodicTask|AsCronTask $attribu
720720
}
721721
$tagAttributes['method'] = $reflector->getName();
722722
}
723+
723724
$definition->addTag('scheduler.task', $tagAttributes);
724725
}
725726
);

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/DummyTask.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
use Symfony\Component\Scheduler\Attribute\AsCronTask;
66
use Symfony\Component\Scheduler\Attribute\AsPeriodicTask;
77

8-
#[AsCronTask(expression: '* * * * *', arguments: [1], schedule: 'dummy')]
9-
#[AsCronTask(expression: '0 * * * *', timezone: 'Europe/Berlin', arguments: ['2'], schedule: 'dummy', method: 'method2')]
10-
#[AsPeriodicTask(frequency: 5, arguments: [3], schedule: 'dummy')]
11-
#[AsPeriodicTask(frequency: 'every day', from: '00:00:00', jitter: 60, arguments: ['4'], schedule: 'dummy', method: 'method4')]
8+
#[AsCronTask(expression: '* * * * *', arguments: [1], schedule: 'dummy_task')]
9+
#[AsCronTask(expression: '0 * * * *', timezone: 'Europe/Berlin', arguments: ['2'], schedule: 'dummy_task', method: 'method2')]
10+
#[AsPeriodicTask(frequency: 5, arguments: [3], schedule: 'dummy_task')]
11+
#[AsPeriodicTask(frequency: '1 day', from: '00:00:00', jitter: 60, arguments: ['4'], schedule: 'dummy_task', method: 'method4')]
1212
class DummyTask
1313
{
1414
public static array $calls = [];
1515

16-
#[AsPeriodicTask(frequency: 'every hour', from: '09:00:00', until: '17:00:00', arguments: ['b' => 6, 'a' => '5'], schedule: 'dummy')]
17-
#[AsCronTask(expression: '0 0 * * *', arguments: ['7', 8], schedule: 'dummy')]
16+
#[AsPeriodicTask(frequency: '1 hour', from: '09:00:00', until: '17:00:00', arguments: ['b' => 6, 'a' => '5'], schedule: 'dummy_task')]
17+
#[AsCronTask(expression: '0 0 * * *', arguments: ['7', 8], schedule: 'dummy_task')]
1818
public function attributesOnMethod(string $a, int $b): void
1919
{
2020
self::$calls[__FUNCTION__][] = [$a, $b];

src/Symfony/Component/Scheduler/DependencyInjection/AddScheduleMessengerPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public function process(ContainerBuilder $container): void
5959

6060
$taskArguments = [
6161
'$message' => $message,
62-
] + array_filter(match ($tagAttributes['trigger'] ?? throw new InvalidArgumentException("Tag 'scheduler.task' is missing attribute 'trigger' on service $serviceId.")) {
62+
] + array_filter(match ($tagAttributes['trigger'] ?? throw new InvalidArgumentException(sprintf('Tag "scheduler.task" is missing attribute "trigger" on service "%s".', $serviceId))) {
6363
'every' => [
64-
'$frequency' => $tagAttributes['frequency'] ?? throw new InvalidArgumentException("Tag 'scheduler.task' is missing attribute 'frequency' on service $serviceId."),
64+
'$frequency' => $tagAttributes['frequency'] ?? throw new InvalidArgumentException(sprintf('Tag "scheduler.task" is missing attribute "frequency" on service "%s".', $serviceId)),
6565
'$from' => $tagAttributes['from'] ?? null,
6666
'$until' => $tagAttributes['until'] ?? null,
6767
],
6868
'cron' => [
69-
'$expression' => $tagAttributes['expression'] ?? throw new InvalidArgumentException("Tag 'scheduler.task' is missing attribute 'expression' on service $serviceId."),
69+
'$expression' => $tagAttributes['expression'] ?? throw new InvalidArgumentException(sprintf('Tag "scheduler.task" is missing attribute "expression" on service "%s".', $serviceId)),
7070
'$timezone' => $tagAttributes['timezone'] ?? null,
7171
],
7272
}, fn ($value) => null !== $value);

0 commit comments

Comments
 (0)
0