diff --git a/src/Illuminate/Redis/Connections/PhpRedisConnection.php b/src/Illuminate/Redis/Connections/PhpRedisConnection.php index fab3cbb95bae..301180a385bc 100644 --- a/src/Illuminate/Redis/Connections/PhpRedisConnection.php +++ b/src/Illuminate/Redis/Connections/PhpRedisConnection.php @@ -91,19 +91,23 @@ public function spop($key, $count = null) * Add one or more members to a sorted set or update its score if it already exists. * * @param string $key - * @param array $membersAndScoresDictionary + * @param mixed $dictionary * @return int */ - public function zadd($key, array $membersAndScoresDictionary) + public function zadd($key, ...$dictionary) { - $arguments = []; + if (count($dictionary) === 1) { + $_dictionary = []; - foreach ($membersAndScoresDictionary as $score => $member) { - $arguments[] = $score; - $arguments[] = $member; + foreach ($dictionary[0] as $member => $score) { + $_dictionary[] = $score; + $_dictionary[] = $member; + } + + $dictionary = $_dictionary; } - return $this->client->zadd($key, ...$arguments); + return $this->client->zadd($key, ...$dictionary); } /**