diff --git a/src/Queue/SynchronousQueue.php b/src/Queue/SynchronousQueue.php index 34c0842e..b2d42e9f 100644 --- a/src/Queue/SynchronousQueue.php +++ b/src/Queue/SynchronousQueue.php @@ -15,23 +15,9 @@ public function enqueue(callable $task) private function drain() { - for ($i = key($this->queue); isset($this->queue[$i]); $i++) { - $task = $this->queue[$i]; - - $exception = null; - - try { - $task(); - } catch (\Exception $exception) { - } - - unset($this->queue[$i]); - - if ($exception) { - throw $exception; - } + /** @var callable $task */ + while ($task = array_shift($this->queue)) { + $task(); } - - $this->queue = []; } }