From 435d8528a75acdbdc2994962bc47e90f4288aed1 Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Sat, 25 Dec 2021 22:10:34 +0100 Subject: [PATCH] Fixed array to string conversion (#718) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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` * Update variable & syntax Co-authored-by: Samuel Ć tancl --- src/CacheManager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CacheManager.php b/src/CacheManager.php index f71908426..88428353a 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."); + $count = count($parameters); + + if ($count !== 1) { + throw new \Exception("Method tags() takes exactly 1 argument. $count passed."); } $names = $parameters[0];