diff --git a/composer.json b/composer.json index 4adaf52..c5c76f3 100644 --- a/composer.json +++ b/composer.json @@ -8,13 +8,13 @@ "require": { "php": ">=7.3.0", "guzzlehttp/guzzle": "^7.4", - "symfony/cache": "^4.0|^5.0|^6.0", + "symfony/cache": "^4.0|^5.0|^6.0|^7.0", "ext-json": "*" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.4.0", "pestphp/pest": "1.21.2", - "phpstan/phpstan": "1.9.x-dev" + "phpstan/phpstan": "^1.10.59" }, "provide": { "psr/simple-cache-implementation": "1.0|2.0|3.0" diff --git a/src/Storyblok/Client.php b/src/Storyblok/Client.php index cb12660..a40dfba 100644 --- a/src/Storyblok/Client.php +++ b/src/Storyblok/Client.php @@ -256,7 +256,7 @@ public function setCache($driver, $options = []): self * * @param string $slug Slug * - * @return \Storyblok\Client + * @return Client */ public function deleteCacheBySlug($slug) { @@ -276,7 +276,7 @@ public function deleteCacheBySlug($slug) /** * Flush all cache. * - * @return \Storyblok\Client + * @return Client */ public function flushCache() { @@ -294,7 +294,7 @@ public function flushCache() * @param mixed $reset * @param mixed $injectValue * - * @return \Storyblok\Client + * @return Client */ public function setCacheVersion($reset = false, $injectValue = '') { @@ -388,7 +388,7 @@ public function getStoryByUuid($uuid) * * @param array $options Options * - * @return \Storyblok\Client + * @return Client */ public function getStories($options = []) { @@ -480,7 +480,7 @@ public function resolveLinks($reference) * * @param array $options Options * - * @return \Storyblok\Client + * @return Client */ public function getTags($options = []) { @@ -512,7 +512,7 @@ public function getTags($options = []) * @param string $slug Slug * @param array $options Options * - * @return \Storyblok\Client + * @return Client */ public function getDatasourceEntries($slug, $options = []) { @@ -551,7 +551,7 @@ public function getDatasourceEntries($slug, $options = []) * * @param array $options Options * - * @return \Storyblok\Client + * @return Client */ public function getLinks($options = []) { @@ -975,7 +975,7 @@ private function insertLinks($node) * * @param string $key Cache key * - * @return \Storyblok\Client + * @return Client */ private function reCacheOnPublish($key) { diff --git a/src/Storyblok/ManagementClient.php b/src/Storyblok/ManagementClient.php index 18469a6..2c3644a 100644 --- a/src/Storyblok/ManagementClient.php +++ b/src/Storyblok/ManagementClient.php @@ -2,6 +2,7 @@ namespace Storyblok; +use GuzzleHttp\Exception\ClientException; use GuzzleHttp\RequestOptions; /** @@ -48,7 +49,7 @@ public function post($endpointUrl, $payload) $responseObj = $this->client->request('POST', $endpointUrl, $requestOptions); return $this->responseHandler($responseObj); - } catch (\GuzzleHttp\Exception\ClientException $e) { + } catch (ClientException $e) { throw new ApiException(self::EXCEPTION_GENERIC_HTTP_ERROR . ' - ' . $e->getMessage(), $e->getCode()); } } @@ -76,7 +77,7 @@ public function put($endpointUrl, $payload) $responseObj = $this->client->request('PUT', $endpointUrl, $requestOptions); return $this->responseHandler($responseObj); - } catch (\GuzzleHttp\Exception\ClientException $e) { + } catch (ClientException $e) { throw new ApiException(self::EXCEPTION_GENERIC_HTTP_ERROR . ' - ' . $e->getMessage(), $e->getCode()); } } @@ -102,7 +103,7 @@ public function delete($endpointUrl) $responseObj = $this->client->request('DELETE', $endpointUrl, $requestOptions); return $this->responseHandler($responseObj); - } catch (\GuzzleHttp\Exception\ClientException $e) { + } catch (ClientException $e) { throw new ApiException(self::EXCEPTION_GENERIC_HTTP_ERROR . ' - ' . $e->getMessage(), $e->getCode()); } } diff --git a/tests/Client.php b/tests/Client.php index f571877..539f02e 100644 --- a/tests/Client.php +++ b/tests/Client.php @@ -1,8 +1,10 @@ setCache('filesytem', ['path' => 'cache']);