From d7d6007c7f5febace0683c3fa354bf4aa6bc6d42 Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Tue, 14 Sep 2021 11:40:53 +0200 Subject: [PATCH 1/2] Fixed array to string conversion Previous code would give this warning before actually showing exception message `PHP Warning: Array to string conversion in .../vendor/stancl/tenancy/src/CacheManager.php on line 24` --- src/CacheManager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CacheManager.php b/src/CacheManager.php index f71908426..d19a02929 100644 --- a/src/CacheManager.php +++ b/src/CacheManager.php @@ -20,8 +20,10 @@ public function __call($method, $parameters) $tags = [config('tenancy.cache.tag_base') . tenant()->getTenantKey()]; if ($method === 'tags') { - if (count($parameters) !== 1) { - throw new \Exception("Method tags() takes exactly 1 argument. {count($parameters)} passed."); + $parameter_count = count($parameters); + + if ($parameter_count !== 1) { + throw new \Exception("Method tags() takes exactly 1 argument. {$parameter_count} passed."); } $names = $parameters[0]; From c310e1df402b032c9bddbb304d6d9121dd33a677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 14 Sep 2021 22:14:51 +0200 Subject: [PATCH 2/2] Update variable & syntax --- src/CacheManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CacheManager.php b/src/CacheManager.php index d19a02929..88428353a 100644 --- a/src/CacheManager.php +++ b/src/CacheManager.php @@ -20,10 +20,10 @@ public function __call($method, $parameters) $tags = [config('tenancy.cache.tag_base') . tenant()->getTenantKey()]; if ($method === 'tags') { - $parameter_count = count($parameters); + $count = count($parameters); - if ($parameter_count !== 1) { - throw new \Exception("Method tags() takes exactly 1 argument. {$parameter_count} passed."); + if ($count !== 1) { + throw new \Exception("Method tags() takes exactly 1 argument. $count passed."); } $names = $parameters[0];