Skip to content

Commit

Permalink
Merge pull request #26 from michalsn/fix/type-casting
Browse files Browse the repository at this point in the history
fix: type casting
  • Loading branch information
michalsn committed Dec 19, 2023
2 parents c7489c1 + 4378c4d commit 047f77d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Commands/QueueFlush.php
Expand Up @@ -56,6 +56,10 @@ public function run(array $params)
$hours = $params['hours'] ?? CLI::getOption('hours');
$queue = $params['queue'] ?? CLI::getOption('queue');

if ($hours !== null) {
$hours = (int) $hours;
}

service('queue')->flush($hours, $queue);

if ($hours === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/QueueForget.php
Expand Up @@ -59,7 +59,7 @@ public function run(array $params)
return EXIT_ERROR;
}

if (service('queue')->forget($id)) {
if (service('queue')->forget((int) $id)) {
CLI::write(sprintf('Failed job with ID %s has been removed.', $id), 'green');
} else {
CLI::write(sprintf('Could not find the failed job with ID %s', $id), 'red');
Expand Down
4 changes: 1 addition & 3 deletions src/Commands/QueueRetry.php
Expand Up @@ -68,9 +68,7 @@ public function run(array $params)
return EXIT_ERROR;
}

if ($id === 'all') {
$id = null;
}
$id = $id === 'all' ? null : (int) $id;

$queue = $params['queue'] ?? CLI::getOption('queue');

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/QueueWork.php
Expand Up @@ -161,7 +161,7 @@ public function run(array $params)
CLI::print('Starting a new job: ', 'cyan');
CLI::print($work->payload['job'], 'light_cyan');
CLI::print(', with ID: ', 'cyan');
CLI::print($work->id, 'light_cyan');
CLI::print((string) $work->id, 'light_cyan');

$this->handleWork($work, $config, $tries, $retryAfter);

Expand Down

0 comments on commit 047f77d

Please sign in to comment.