diff --git a/composer.json b/composer.json index 4187bb3..61072d9 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": ">=8.0", "guzzlehttp/guzzle": ">=6.3.3", "psr/log": ">=1", - "psr/simple-cache": "1.*|2.*", + "psr/simple-cache": "1.*|2.*|3.*", "ext-json": "*" }, "require-dev": { diff --git a/src/Cache/MemoryCache.php b/src/Cache/MemoryCache.php index 8be88b7..9386a5b 100644 --- a/src/Cache/MemoryCache.php +++ b/src/Cache/MemoryCache.php @@ -27,7 +27,7 @@ public static function getInstance(): MemoryCache /** * @inheritDoc */ - public function get($key, $default = null) + public function get($key, $default = null): mixed { return $this->cache[$key] ?? $default; } @@ -38,7 +38,7 @@ public function get($key, $default = null) * @param $ttl - Ignored since its in memory * @return bool|void */ - public function set($key, $value, $ttl = null) + public function set($key, $value, $ttl = null): bool { $this->cache[$key] = $value; return true; @@ -47,7 +47,7 @@ public function set($key, $value, $ttl = null) /** * @inheritDoc */ - public function delete($key) + public function delete($key): bool { $return = false; if ($this->has($key)) { @@ -61,7 +61,7 @@ public function delete($key) /** * @inheritDoc */ - public function clear() + public function clear(): bool { $this->cache = []; return true; @@ -70,7 +70,7 @@ public function clear() /** * @inheritDoc */ - public function getMultiple($keys, $default = null) + public function getMultiple($keys, $default = null): iterable { $items = $default ?? []; foreach ($keys as $key) { @@ -89,7 +89,7 @@ public function getMultiple($keys, $default = null) /** * @inheritDoc */ - public function setMultiple($values, $ttl = null) + public function setMultiple($values, $ttl = null): bool { foreach ($values as $key => $value) { $this->set($key, $value, $ttl); @@ -101,7 +101,7 @@ public function setMultiple($values, $ttl = null) /** * @inheritDoc */ - public function deleteMultiple($keys) + public function deleteMultiple($keys): bool { $return = true; foreach ($keys as $key) { @@ -116,7 +116,7 @@ public function deleteMultiple($keys) /** * @inheritDoc */ - public function has($key) + public function has($key): bool { return isset($this->cache[$key]); } diff --git a/src/Endpoint/Traits/JsonHandlerTrait.php b/src/Endpoint/Traits/JsonHandlerTrait.php index 3422db2..c1c8e6b 100644 --- a/src/Endpoint/Traits/JsonHandlerTrait.php +++ b/src/Endpoint/Traits/JsonHandlerTrait.php @@ -19,7 +19,7 @@ protected function configureJsonRequest(Request $request): Request */ public function getResponseContent(Response $response, bool $associative = true): mixed { - if (!$this->_respContent) { + if (empty($this->_respContent)) { $this->_respContent = $response->getBody()->getContents(); $response->getBody()->rewind(); }