Why this matters
Swallowed errors make queues appear healthy while losing work.
Background jobs must throw on irrecoverable failures (after logging) so the runner/queue can retry or dead-letter appropriately.
Swallowed errors make queues appear healthy while losing work.
Side-by-side examples engineers can pattern-match during review.
try { handleJob($job); } catch (Throwable $e) { $logger->error($e->getMessage()); /* swallow */ }try { handleJob($job); } catch (Throwable $e) {
$logger->error('job failed', ['jobId'=>$job->id, 'e'=>$e]);
throw $e; // trigger retry/DLQ
}catch(Throwable $e){ /* log only */ }catch(Throwable $e){ $logger->error(...); throw $e; }From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.