Skip to content

Commit 047f77d

Browse files
authored
Merge pull request #26 from michalsn/fix/type-casting
fix: type casting
2 parents c7489c1 + 4378c4d commit 047f77d

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/Commands/QueueFlush.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public function run(array $params)
5656
$hours = $params['hours'] ?? CLI::getOption('hours');
5757
$queue = $params['queue'] ?? CLI::getOption('queue');
5858

59+
if ($hours !== null) {
60+
$hours = (int) $hours;
61+
}
62+
5963
service('queue')->flush($hours, $queue);
6064

6165
if ($hours === null) {

src/Commands/QueueForget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function run(array $params)
5959
return EXIT_ERROR;
6060
}
6161

62-
if (service('queue')->forget($id)) {
62+
if (service('queue')->forget((int) $id)) {
6363
CLI::write(sprintf('Failed job with ID %s has been removed.', $id), 'green');
6464
} else {
6565
CLI::write(sprintf('Could not find the failed job with ID %s', $id), 'red');

src/Commands/QueueRetry.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ public function run(array $params)
6868
return EXIT_ERROR;
6969
}
7070

71-
if ($id === 'all') {
72-
$id = null;
73-
}
71+
$id = $id === 'all' ? null : (int) $id;
7472

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

src/Commands/QueueWork.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function run(array $params)
161161
CLI::print('Starting a new job: ', 'cyan');
162162
CLI::print($work->payload['job'], 'light_cyan');
163163
CLI::print(', with ID: ', 'cyan');
164-
CLI::print($work->id, 'light_cyan');
164+
CLI::print((string) $work->id, 'light_cyan');
165165

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

0 commit comments

Comments
 (0)