Skip to content
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2.0.2
=====

* (bug) Add missing dependency.
* (improvement) Bump required Doctrine version.


2.0.1
=====

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"php": ">= 8.3",
"21torr/bundle-helpers": "^2.1",
"21torr/cli": "^1.2.3",
"doctrine/orm": "^2.19",
"doctrine/doctrine-bundle": "^2.13",
"doctrine/orm": "^2.19 || ^3.0",
"dragonmantank/cron-expression": "^3.3",
"symfony/clock": "^7.1",
"symfony/config": "^7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function listTasks (TorrStyle $io) : void
$first = false;
}

$row[] = sprintf(
$row[] = \sprintf(
"<fg=yellow>%s</>",
$metaData->getKey(),
);
Expand Down
8 changes: 4 additions & 4 deletions src/Command/QueueTasksCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ protected function execute (InputInterface $input, OutputInterface $output) : in
return self::FAILURE;
}

$io->comment(sprintf(
$io->comment(\sprintf(
"Queuing <fg=magenta>%d</> task%s",
\count($tasksToQueue),
1 !== \count($tasksToQueue) ? "s" : "",
));

foreach ($tasksToQueue as $task)
{
$io->writeln(sprintf(
$io->writeln(\sprintf(
"• Queuing task %s",
$this->formatTaskLabel($task),
));
Expand Down Expand Up @@ -141,7 +141,7 @@ private function fetchTasksByKey (array $keys) : array
foreach ($keys as $taskKey)
{
$result[] = $this->taskRegistry->getTaskByKey($taskKey)
?? throw new UnknownTaskKeyException(sprintf(
?? throw new UnknownTaskKeyException(\sprintf(
"Unknown task key '%s'",
$taskKey,
));
Expand All @@ -159,7 +159,7 @@ private function formatTaskLabel (Task $task) : string

if (null !== $metaData->group)
{
return sprintf(
return \sprintf(
"<fg=blue>%s</>: %s (<fg=yellow>%s</>)",
$metaData->group,
$metaData->label,
Expand Down
14 changes: 7 additions & 7 deletions src/Command/TaskLogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function showTaskDetails (TorrStyle $io, int $taskId) : int

if (null === $task)
{
$io->error(sprintf("No task found with id '%d'", $taskId));
$io->error(\sprintf("No task found with id '%d'", $taskId));

return self::FAILURE;
}
Expand All @@ -120,15 +120,15 @@ private function showTaskDetails (TorrStyle $io, int $taskId) : int

if (null !== $task->getHandledBy())
{
$handled[] = sprintf(
$handled[] = \sprintf(
"<fg=blue>%s</>",
$task->getHandledBy(),
);
}

if (null !== $task->getTransport())
{
$handled[] = sprintf(
$handled[] = \sprintf(
"<fg=blue>%s</>",
$task->getTransport(),
);
Expand Down Expand Up @@ -158,19 +158,19 @@ private function showTaskDetails (TorrStyle $io, int $taskId) : int
: "<fg=red>failed</>";
}

$io->section(sprintf(
$io->section(\sprintf(
"Run %d (%s)",
$index,
$status,
));
$io->writeln(sprintf(
$io->writeln(\sprintf(
"Started: %s",
$run->getTimeStarted()->format("c"),
));

if ($run->isFinished())
{
$io->writeln(sprintf(
$io->writeln(\sprintf(
"Duration: %s",
$this->formatDuration((float) $run->getDuration()),
));
Expand Down Expand Up @@ -212,7 +212,7 @@ private function showList (TorrStyle $io, int $limit) : void

$rows[] = [
$task->getId(),
sprintf(
\sprintf(
"<fg=%s>%s</>",
null !== $task->getTaskLabel() ? "yellow" : "gray",
$task->getTaskLabel() ?? "—",
Expand Down
2 changes: 1 addition & 1 deletion src/Event/RegisterTasksEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function register (Task $task) : self

if (\array_key_exists($key, $this->tasks))
{
throw new DuplicateTaskRegisteredException(sprintf(
throw new DuplicateTaskRegisteredException(\sprintf(
"Duplicate task registered with key '%s'",
$key,
));
Expand Down
2 changes: 1 addition & 1 deletion src/Log/LogCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function cleanLogEntries () : array

foreach ($this->model->fetchOutdatedTasks($this->logTtlInDays) as $logEntry)
{
$deleted[] = sprintf(
$deleted[] = \sprintf(
"<fg=yellow>%s</> (%s)",
$logEntry->getTaskLabel(),
$logEntry->getTimeQueued()->format("c"),
Expand Down
4 changes: 2 additions & 2 deletions src/Log/Task/CleanOutdatedLogsTaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function onCleanOutdatedLogs (CleanOutdatedLogsTask $task) : void
$io = $run->getIo();

$io->title("Task Manager: Cleaning Outdated Log Entries");
$io->comment(sprintf(
$io->comment(\sprintf(
"Cleaning log entries older than <fg=blue>%d days</>",
$this->logCleaner->getMaxLogEntryAge(),
));
Expand All @@ -42,7 +42,7 @@ public function onCleanOutdatedLogs (CleanOutdatedLogsTask $task) : void
$io->writeln("Removed:");
$io->listing($deletedEntries);

$io->success(sprintf(
$io->success(\sprintf(
"Deleted <fg=yellow>%d</> %s:",
\count($deletedEntries),
1 !== \count($deletedEntries)
Expand Down
2 changes: 1 addition & 1 deletion src/Manager/TaskManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function fetchTasksInQueue (string $queueName) : iterable

if (!$receiver instanceof ListableReceiverInterface)
{
throw new InvalidMessageTransportException(sprintf(
throw new InvalidMessageTransportException(\sprintf(
"Transport for queue '%s' must implement ListableReceiverInterface",
$queueName,
));
Expand Down
4 changes: 1 addition & 3 deletions src/Model/TaskLogModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public function __construct (
private readonly ClockInterface $clock,
)
{
$repository = $this->entityManager->getRepository(TaskLog::class);
\assert($repository instanceof EntityRepository);
$this->repository = $repository;
$this->repository = $this->entityManager->getRepository(TaskLog::class);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Transport/TransportsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getTransport (string $queueName) : TransportInterface
catch (ServiceNotFoundException $exception)
{
throw new InvalidMessageTransportException(
message: sprintf(
message: \sprintf(
"No transport found with queue name '%s'",
$queueName,
),
Expand Down