Skip to content

Commit

Permalink
Fixed array to string conversion (#718)
Browse files Browse the repository at this point in the history
* Fixed array to string conversion

Previous code would give this warning before actually showing exception message
`<warning>PHP Warning:  Array to string conversion in .../vendor/stancl/tenancy/src/CacheManager.php on line 24</warning>`

* Update variable & syntax

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
  • Loading branch information
kg-bot and stancl authored Dec 25, 2021
1 parent 08bfd6f commit 435d852
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 435d852

Please sign in to comment.