From db615f1e606013afb660dec3c69eb9e6a1fcc9ad Mon Sep 17 00:00:00 2001 From: michalsn Date: Fri, 17 Jan 2025 12:18:14 +0100 Subject: [PATCH] cs fix --- .php-cs-fixer.dist.php | 2 +- src/Commands/QueueWork.php | 2 +- src/Handlers/BaseHandler.php | 10 +++++----- src/Handlers/PredisHandler.php | 2 +- src/Handlers/RedisHandler.php | 2 +- src/Models/QueueJobModel.php | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index f82bdbf..001fd00 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -37,5 +37,5 @@ return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter Queue', 'CodeIgniter Foundation', - 'admin@codeigniter.com' + 'admin@codeigniter.com', ); diff --git a/src/Commands/QueueWork.php b/src/Commands/QueueWork.php index 391917d..6a4d4fb 100644 --- a/src/Commands/QueueWork.php +++ b/src/Commands/QueueWork.php @@ -108,7 +108,7 @@ public function run(array $params) $memory, $priority, $tries, - $retryAfter + $retryAfter, ] = $this->readOptions($params, $config, $queue); if ($error !== null) { diff --git a/src/Handlers/BaseHandler.php b/src/Handlers/BaseHandler.php index 6e29e45..07aeb3a 100644 --- a/src/Handlers/BaseHandler.php +++ b/src/Handlers/BaseHandler.php @@ -72,11 +72,11 @@ public function retry(?int $id, ?string $queue): int $jobs = model(QueueJobFailedModel::class) ->when( $id !== null, - static fn ($query) => $query->where('id', $id) + static fn ($query) => $query->where('id', $id), ) ->when( $queue !== null, - static fn ($query) => $query->where('queue', $queue) + static fn ($query) => $query->where('queue', $queue), ) ->findAll(); @@ -112,11 +112,11 @@ public function flush(?int $hours, ?string $queue): bool return model(QueueJobFailedModel::class) ->when( $hours !== null, - static fn ($query) => $query->where('failed_at <=', Time::now()->subHours($hours)->timestamp) + static fn ($query) => $query->where('failed_at <=', Time::now()->subHours($hours)->timestamp), ) ->when( $queue !== null, - static fn ($query) => $query->where('queue', $queue) + static fn ($query) => $query->where('queue', $queue), ) ->delete(); } @@ -129,7 +129,7 @@ public function listFailed(?string $queue): array return model(QueueJobFailedModel::class) ->when( $queue !== null, - static fn ($query) => $query->where('queue', $queue) + static fn ($query) => $query->where('queue', $queue), ) ->orderBy('failed_at', 'desc') ->findAll(); diff --git a/src/Handlers/PredisHandler.php b/src/Handlers/PredisHandler.php index 39256bf..4c2114d 100644 --- a/src/Handlers/PredisHandler.php +++ b/src/Handlers/PredisHandler.php @@ -123,7 +123,7 @@ public function later(QueueJob $queueJob, int $seconds): bool $result = $this->predis->zadd( "queues:{$queueJob->queue}:{$queueJob->priority}", - [json_encode($queueJob) => $queueJob->available_at->timestamp] + [json_encode($queueJob) => $queueJob->available_at->timestamp], ); if ($result !== 0) { $this->predis->hdel("queues:{$queueJob->queue}::reserved", [$queueJob->id]); diff --git a/src/Handlers/RedisHandler.php b/src/Handlers/RedisHandler.php index 06255ad..8fcf27f 100644 --- a/src/Handlers/RedisHandler.php +++ b/src/Handlers/RedisHandler.php @@ -145,7 +145,7 @@ public function later(QueueJob $queueJob, int $seconds): bool $result = (int) $this->redis->zAdd( "queues:{$queueJob->queue}:{$queueJob->priority}", $queueJob->available_at->timestamp, - json_encode($queueJob) + json_encode($queueJob), ); if ($result !== 0) { $this->redis->hDel("queues:{$queueJob->queue}::reserved", (string) $queueJob->id); diff --git a/src/Models/QueueJobModel.php b/src/Models/QueueJobModel.php index 6aaf910..4df5bd1 100644 --- a/src/Models/QueueJobModel.php +++ b/src/Models/QueueJobModel.php @@ -141,22 +141,22 @@ private function setPriority(BaseBuilder $builder, array $priority): BaseBuilder sprintf('CASE %s ', $this->db->protectIdentifiers('priority')) . implode( ' ', - array_map(static fn ($value, $key) => "WHEN '{$value}' THEN {$key}", $priority, array_keys($priority)) + array_map(static fn ($value, $key) => "WHEN '{$value}' THEN {$key}", $priority, array_keys($priority)), ) . ' END', '', - false + false, ); } else { $builder->orderBy( 'FIELD(priority, ' . implode( ',', - array_map(static fn ($value) => "'{$value}'", $priority) + array_map(static fn ($value) => "'{$value}'", $priority), ) . ')', '', - false + false, ); } }