From b2d6414f816f8d5504865fd825d7c2f42c523bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20Demircio=C4=9Flu?= <31544037+atakde@users.noreply.github.com> Date: Thu, 30 Jun 2022 00:54:32 +0300 Subject: [PATCH] WorkerPool :: added missing return type & strict comparison --- Creational/Pool/WorkerPool.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Creational/Pool/WorkerPool.php b/Creational/Pool/WorkerPool.php index 82426a9..6b4f3d8 100644 --- a/Creational/Pool/WorkerPool.php +++ b/Creational/Pool/WorkerPool.php @@ -20,7 +20,7 @@ class WorkerPool implements Countable public function get(): StringReverseWorker { - if (count($this->freeWorkers) == 0) { + if (count($this->freeWorkers) === 0) { $worker = new StringReverseWorker(); } else { $worker = array_pop($this->freeWorkers); @@ -31,10 +31,9 @@ class WorkerPool implements Countable return $worker; } - public function dispose(StringReverseWorker $worker) + public function dispose(StringReverseWorker $worker): void { $key = spl_object_hash($worker); - if (isset($this->occupiedWorkers[$key])) { unset($this->occupiedWorkers[$key]); $this->freeWorkers[$key] = $worker;