From a03b004adadb7461573d5c8a72b15c11cbaaf30e Mon Sep 17 00:00:00 2001 From: BigBadBassMan Date: Mon, 12 May 2025 11:08:53 +0200 Subject: [PATCH 1/2] feat(exception)!: declare RedisClusterException on most methods --- redis/RedisCluster.php | 211 +++++++++++++++++++++++++++++++++++------ 1 file changed, 183 insertions(+), 28 deletions(-) diff --git a/redis/RedisCluster.php b/redis/RedisCluster.php index aa9218e46..7fda124b4 100644 --- a/redis/RedisCluster.php +++ b/redis/RedisCluster.php @@ -71,6 +71,7 @@ public function close() {} * * @return string|false If key didn't exist, FALSE is returned. Otherwise, the value related to this key is * returned. + * @throws RedisClusterException * * @link https://redis.io/commands/get * @example @@ -91,6 +92,7 @@ public function get($key) {} * >= 2.6.12 extended options if you pass an array with valid values. * * @return bool TRUE if the command is successful. + * @throws RedisClusterException * * @link https://redis.io/commands/set * @example @@ -119,6 +121,7 @@ public function set($key, $value, $timeout = null) {} * @param array $array * * @return array + * @throws RedisClusterException * * @link https://redis.io/commands/mget * @example @@ -149,6 +152,7 @@ public function mget(array $array) {} * @param array $array Pairs: array(key => value, ...) * * @return bool TRUE in case of success, FALSE in case of failure. + * @throws RedisClusterException * @link https://redis.io/commands/mset * @example *
@@ -163,11 +167,12 @@ public function mget(array $array) {}
     public function mset(array $array) {}
 
     /**
-     * @see     mset()
-     *
      * @param   array $array
      *
      * @return  int 1 (if the keys were set) or 0 (no key was set)
+     * @throws  RedisClusterException
+     * @see     mset()
+     *
      * @link    https://redis.io/commands/msetnx
      */
     public function msetnx(array $array) {}
@@ -180,6 +185,7 @@ public function msetnx(array $array) {}
      * @param int|string ...$otherKeys
      *
      * @return int Number of keys deleted.
+     * @throws RedisClusterException
      * @link    https://redis.io/commands/del
      * @example
      * 
@@ -201,6 +207,7 @@ public function del($key1, ...$otherKeys) {}
      * @param   mixed $value
      *
      * @return  bool   TRUE if the command is successful.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/setex
      * @example
      * 
@@ -218,6 +225,7 @@ public function setex($key, $ttl, $value) {}
      * @param   string $value
      *
      * @return  bool   TRUE if the command is successful.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/psetex
      * @example
      * 
@@ -233,6 +241,7 @@ public function psetex($key, $ttl, $value) {}
      * @param   string $value
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/setnx
      * @example
      * 
@@ -249,6 +258,7 @@ public function setnx($key, $value) {}
      * @param   string $value
      *
      * @return  string  A string, the previous value located at this key.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/getset
      * @example
      * 
@@ -265,6 +275,7 @@ public function getSet($key, $value) {}
      * @param   string $key
      *
      * @return  bool If the key exists, return TRUE, otherwise return FALSE.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/exists
      * @example
      * 
@@ -281,6 +292,7 @@ public function exists($key) {}
      * @param   string $pattern pattern, using '*' as a wildcard.
      *
      * @return  array   of STRING: The keys that match a certain pattern.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/keys
      * @example
      * 
@@ -296,6 +308,7 @@ public function keys($pattern) {}
      * @param   string $key
      *
      * @return  int
+     * @throws  RedisClusterException
      *
      * Depending on the type of the data pointed by the key,
      * this method will return the following value:
@@ -316,6 +329,7 @@ public function type($key) {}
      * @param   string $key
      *
      * @return  string|false if command executed successfully BOOL FALSE in case of failure (empty list)
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/lpop
      * @example
      * 
@@ -346,6 +360,7 @@ public function lPop($key) {}
      * @param   string $key
      *
      * @return  string|false if command executed successfully BOOL FALSE in case of failure (empty list)
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/rpop
      * @example
      * 
@@ -378,6 +393,7 @@ public function rPop($key) {}
      * @param string $value
      *
      * @return bool TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key
+     * @throws RedisClusterException
      * is not a list.
      * @link    https://redis.io/commands/lset
      * @example
@@ -397,8 +413,8 @@ public function lSet($key, $index, $value) {}
      *
      * @param   string $key
      *
-     * @return  string  "popped" value
-     * bool FALSE if set identified by key is empty or doesn't exist.
+     * @return  string  "popped" value, bool FALSE if set identified by key is empty or doesn't exist.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/spop
      * @example
      * 
@@ -424,6 +440,7 @@ public function sPop($key) {}
      * @param   string $valueN Optional
      *
      * @return  int|false    The new length of the list in case of success, FALSE in case of Failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/lpush
      * @example
      * 
@@ -450,6 +467,7 @@ public function lPush($key, $value1, $value2 = null, $valueN = null) {}
      * @param   string $valueN Optional
      *
      * @return  int|false     The new length of the list in case of success, FALSE in case of Failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/rpush
      * @example
      * 
@@ -478,6 +496,7 @@ public function rPush($key, $value1, $value2 = null, $valueN = null) {}
      * @param int   $timeout Timeout
      *
      * @return  array array('listName', 'element')
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/blpop
      * @example
      * 
@@ -524,6 +543,7 @@ public function blPop(array $keys, $timeout) {}
      * @param int   $timeout Timeout
      *
      * @return  array array('listName', 'element')
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/brpop
      * @example
      * 
@@ -562,6 +582,7 @@ public function brPop(array $keys, $timeout) {}
      * @param   string $value String, value to push in key
      *
      * @return  int|false     The new length of the list in case of success, FALSE in case of Failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/rpushx
      * @example
      * 
@@ -582,6 +603,7 @@ public function rPushx($key, $value) {}
      * @param   string $value String, value to push in key
      *
      * @return  int|false     The new length of the list in case of success, FALSE in case of Failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/lpushx
      * @example
      * 
@@ -606,6 +628,7 @@ public function lPushx($key, $value) {}
      * @param   string $value
      *
      * @return  int     The number of the elements in the list, -1 if the pivot didn't exists.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/linsert
      * @example
      * 
@@ -635,8 +658,9 @@ public function lInsert($key, $position, $pivot, $value) {}
      * @param string $key
      * @param int    $index
      *
-     * @return string|false the element at this index
+     * @return string|false the element at this index, 
      * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key.
+     * @throws RedisClusterException
      * @link    https://redis.io/commands/lindex
      * @example
      * 
@@ -661,6 +685,7 @@ public function lIndex($key, $index) {}
      *
      * @return  int     the number of elements to remove
      * bool FALSE if the value identified by key is not a list.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/lrem
      * @example
      * 
@@ -685,6 +710,7 @@ public function lRem($key, $value, $count) {}
      * @param   int    $timeout
      *
      * @return  string|false  The element that was moved in case of success, FALSE in case of timeout.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/brpoplpush
      */
     public function brpoplpush($srcKey, $dstKey, $timeout) {}
@@ -693,12 +719,13 @@ public function brpoplpush($srcKey, $dstKey, $timeout) {}
      * Pops a value from the tail of a list, and pushes it to the front of another list.
      * Also return this value.
      *
-     * @since   redis >= 1.2
-     *
      * @param   string $srcKey
      * @param   string $dstKey
      *
      * @return  string|false  The element that was moved in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
+     * @since   redis >= 1.2
+     *
      * @link    https://redis.io/commands/rpoplpush
      * @example
      * 
@@ -741,6 +768,7 @@ public function rpoplpush($srcKey, $dstKey) {}
      *
      * @return  int     The size of the list identified by Key exists.
      * bool FALSE if the data type identified by Key is not list
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/llen
      * @example
      * 
@@ -760,6 +788,7 @@ public function lLen($key) {}
      * @param   string $key
      *
      * @return  int   the cardinality (number of elements) of the set, or 0 if key does not exist.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/scard
      * @example
      * 
@@ -779,6 +808,7 @@ public function sCard($key) {}
      * @param   string $key
      *
      * @return  array   All elements of the set.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/smembers
      * @example
      * 
@@ -811,6 +841,7 @@ public function sMembers($key) {}
      * @param   string $value
      *
      * @return  bool    TRUE if value is a member of the set at key key, FALSE otherwise.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sismember
      * @example
      * 
@@ -834,6 +865,7 @@ public function sIsMember($key, $value) {}
      * @param   mixed $valueN Optional value
      *
      * @return  int|false     The number of elements added to the set
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sadd
      * @example
      * 
@@ -851,6 +883,7 @@ public function sAdd($key, $value1, $value2 = null, $valueN = null) {}
      * @param   array  $valueArray
      *
      * @return  int|false     The number of elements added to the set
+     * @throws  RedisClusterException
      * @example
      * 
      * $redisCluster->sAddArray('k', ['v1', 'v2', 'v3']);
@@ -868,6 +901,7 @@ public function sAddArray($key, array $valueArray) {}
      * @param   string $memberN
      *
      * @return  int     The number of elements removed from the set.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/srem
      * @example
      * 
@@ -890,6 +924,7 @@ public function sRem($key, $member1, $member2 = null, $memberN = null) {}
      * @param   string $keyN ...
      *
      * @return  array   of strings: The union of all these sets.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sunionstore
      * @example
      * 
@@ -929,6 +964,7 @@ public function sUnion($key1, $key2, $keyN = null) {}
      * @param   string $keyN   ...
      *
      * @return  int     Any number of keys corresponding to sets in redis.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sunionstore
      * @example
      * 
@@ -972,6 +1008,7 @@ public function sUnionStore($dstKey, $key1, $key2, $keyN = null) {}
      *
      * @return  array contain the result of the intersection between those keys.
      * If the intersection between the different sets is empty, the return value will be empty array.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sinterstore
      * @example
      * 
@@ -1009,6 +1046,7 @@ public function sInter($key1, $key2, $keyN = null) {}
      * @param   string $keyN   ...
      *
      * @return  int|false    The cardinality of the resulting set, or FALSE in case of a missing key.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sinterstore
      * @example
      * 
@@ -1047,6 +1085,7 @@ public function sInterStore($dstKey, $key1, $key2, $keyN = null) {}
      * @param   string $keyN ...
      *
      * @return  array   of strings: The difference of the first set will all the others.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sdiff
      * @example
      * 
@@ -1083,6 +1122,7 @@ public function sDiff($key1, $key2, $keyN = null) {}
      * @param   string $keyN   ...
      *
      * @return  int|false    The cardinality of the resulting set, or FALSE in case of a missing key.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sdiffstore
      * @example
      * 
@@ -1120,6 +1160,7 @@ public function sDiffStore($dstKey, $key1, $key2, $keyN = null) {}
      *
      * @return  string|array  value(s) from the set
      * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/srandmember
      * @example
      * 
@@ -1147,6 +1188,7 @@ public function sRandMember($key, $count = null) {}
      * @param   string $key
      *
      * @return  int
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/strlen
      * @example
      * 
@@ -1162,6 +1204,7 @@ public function strlen($key) {}
      * @param   string $key
      *
      * @return  bool   TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/persist
      * @example $redisCluster->persist('key');
      */
@@ -1177,6 +1220,7 @@ public function persist($key) {}
      * @param   string $key
      *
      * @return  int    the time left to live in seconds.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/ttl
      * @example $redisCluster->ttl('key');
      */
@@ -1192,6 +1236,7 @@ public function ttl($key) {}
      * @param   string $key
      *
      * @return  int     the time left to live in milliseconds.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pttl
      * @example $redisCluster->pttl('key');
      */
@@ -1203,6 +1248,7 @@ public function pttl($key) {}
      * @param   string $key
      *
      * @return  int     the set's cardinality
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zsize
      * @example
      * 
@@ -1224,6 +1270,7 @@ public function zCard($key) {}
      * @param   string $end
      *
      * @return  int     the size of a corresponding zRangeByScore.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zcount
      * @example
      * 
@@ -1243,6 +1290,7 @@ public function zCount($key, $start, $end) {}
      * @param   string $end double or "+inf" or "-inf" as a string
      *
      * @return  int             The number of values deleted from the sorted set
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zremrangebyscore
      * @example
      * 
@@ -1261,6 +1309,7 @@ public function zRemRangeByScore($key, $start, $end) {}
      * @param   string $member
      *
      * @return  float
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zscore
      * @example
      * 
@@ -1282,6 +1331,7 @@ public function zScore($key, $member) {}
      * @param   string $valueN Optional value
      *
      * @return  int     Number of values added
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zadd
      * @example
      * 
@@ -1305,6 +1355,7 @@ public function zAdd($key, $score1, $value1, $score2 = null, $value2 = null, $sc
      * @param   string $member
      *
      * @return  float   the new value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zincrby
      * @example
      * 
@@ -1322,6 +1373,7 @@ public function zIncrBy($key, $value, $member) {}
      * @param   string $key
      *
      * @return  int|false     the number of items in a hash, FALSE if the key doesn't exist or isn't a hash.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hlen
      * @example
      * 
@@ -1339,6 +1391,7 @@ public function hLen($key) {}
      * @param   string $key
      *
      * @return  array   An array of elements, the keys of the hash. This works like PHP's array_keys().
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hkeys
      * @example
      * 
@@ -1372,6 +1425,7 @@ public function hKeys($key) {}
      * @param   string $key
      *
      * @return  array   An array of elements, the values of the hash. This works like PHP's array_values().
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hvals
      * @example
      * 
@@ -1407,6 +1461,7 @@ public function hVals($key) {}
      * @param   string $hashKey
      *
      * @return  string|false  The value, if the command executed successfully BOOL FALSE in case of failure
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hget
      * @example
      * 
@@ -1423,6 +1478,7 @@ public function hGet($key, $hashKey) {}
      * @param   string $key
      *
      * @return  array   An array of elements, the contents of the hash.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hgetall
      * @example
      * 
@@ -1457,6 +1513,7 @@ public function hGetAll($key) {}
      * @param   string $hashKey
      *
      * @return  bool   If the member exists in the hash table, return TRUE, otherwise return FALSE.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hexists
      * @example
      * 
@@ -1475,6 +1532,7 @@ public function hExists($key, $hashKey) {}
      * @param   int    $value (integer) value that will be added to the member's value
      *
      * @return  int     the new value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hincrby
      * @example
      * 
@@ -1495,6 +1553,7 @@ public function hIncrBy($key, $hashKey, $value) {}
      * @return int
      * 1 if value didn't exist and was added successfully,
      * 0 if the value was already present and was replaced, FALSE if there was an error.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hset
      * @example
      * 
@@ -1516,6 +1575,7 @@ public function hSet($key, $hashKey, $value) {}
      * @param   string $value
      *
      * @return  bool    TRUE if the field was set, FALSE if it was already present.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hsetnx
      * @example
      * 
@@ -1535,6 +1595,7 @@ public function hSetNx($key, $hashKey, $value) {}
      *
      * @return  array   Array An array of elements, the values of the specified fields in the hash,
      * with the hash keys as array keys.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hmget
      * @example
      * 
@@ -1555,6 +1616,7 @@ public function hMGet($key, $hashKeys) {}
      * @param   array  $hashKeys key → value array
      *
      * @return  bool
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hmset
      * @example
      * 
@@ -1575,6 +1637,7 @@ public function hMSet($key, $hashKeys) {}
      * @param   string $hashKeyN
      *
      * @return  int     Number of deleted fields
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hdel
      * @example
      * 
@@ -1608,6 +1671,7 @@ public function hDel($key, $hashKey1, $hashKey2 = null, $hashKeyN = null) {}
      * @param   float  $increment
      *
      * @return  float
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hincrbyfloat
      * @example
      * 
@@ -1636,6 +1700,7 @@ public function hIncrByFloat($key, $field, $increment) {}
      * @param   string $key
      *
      * @return  string|false  The Redis encoded value of the key, or FALSE if the key doesn't exist
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/dump
      * @example
      * 
@@ -1653,6 +1718,7 @@ public function dump($key) {}
      * @param   string $member
      *
      * @return  int     the item's score.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zrank
      * @example
      * 
@@ -1668,12 +1734,13 @@ public function dump($key) {}
     public function zRank($key, $member) {}
 
     /**
-     * @see    zRank()
-     *
      * @param  string $key
      * @param  string $member
      *
      * @return int    the item's score
+     * @throws RedisClusterException
+     * @see    zRank()
+     *
      * @link   https://redis.io/commands/zrevrank
      */
     public function zRevRank($key, $member) {}
@@ -1684,6 +1751,7 @@ public function zRevRank($key, $member) {}
      * @param   string $key
      *
      * @return  int    the new value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/incr
      * @example
      * 
@@ -1701,6 +1769,7 @@ public function incr($key) {}
      * @param   string $key
      *
      * @return  int    the new value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/decr
      * @example
      * 
@@ -1719,6 +1788,7 @@ public function decr($key) {}
      * @param   int    $value value that will be added to key (only for incrBy)
      *
      * @return  int         the new value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/incrby
      * @example
      * 
@@ -1739,6 +1809,7 @@ public function incrBy($key, $value) {}
      * @param   int    $value that will be subtracted to key (only for decrBy)
      *
      * @return  int       the new value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/decrby
      * @example
      * 
@@ -1757,6 +1828,7 @@ public function decrBy($key, $value) {}
      * @param   float  $increment
      *
      * @return  float
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/incrbyfloat
      * @example
      * 
@@ -1775,6 +1847,7 @@ public function incrByFloat($key, $increment) {}
      * @param   int    $ttl The key's remaining Time To Live, in seconds.
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/expire
      * @example
      * 
@@ -1793,6 +1866,7 @@ public function expire($key, $ttl) {}
      * @param   int    $ttl The key's remaining Time To Live, in milliseconds.
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pexpire
      * @example
      * 
@@ -1811,6 +1885,7 @@ public function pExpire($key, $ttl) {}
      * @param   int    $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time.
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/expireat
      * @example
      * 
@@ -1830,6 +1905,7 @@ public function expireAt($key, $timestamp) {}
      * @param   int    $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time.
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pexpireat
      * @example
      * 
@@ -1848,6 +1924,7 @@ public function pExpireAt($key, $timestamp) {}
      * @param   string $value
      *
      * @return  int    Size of the value after the append
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/append
      * @example
      * 
@@ -1865,6 +1942,7 @@ public function append($key, $value) {}
      * @param   int    $offset
      *
      * @return  int    the bit value (0 or 1)
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/getbit
      * @example
      * 
@@ -1883,6 +1961,7 @@ public function getBit($key, $offset) {}
      * @param   bool|int $value bool or int (1 or 0)
      *
      * @return  int    0 or 1, the value of the bit before it was set.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/setbit
      * @example
      * 
@@ -1904,6 +1983,7 @@ public function setBit($key, $offset, $value) {}
      * @param   string $key3
      *
      * @return  int     The size of the string stored in the destination key.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/bitop
      * @example
      * 
@@ -1938,6 +2018,7 @@ public function bitOp($operation, $retKey, $key1, $key2, $key3 = null) {}
      *                  start argument only. However, this behavior changes if you are looking for clear bits and
      *                  specify a range with both start and end. If no clear bit is found in the specified range, the
      *                  function returns -1 as the user specified a clear range and there are no 0 bits in that range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/bitpos
      * @example
      * 
@@ -1958,6 +2039,7 @@ public function bitpos($key, $bit, $start = 0, $end = null) {}
      * @param   string $key
      *
      * @return  int     The number of bits set to 1 in the value behind the input key.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/bitcount
      * @example
      * 
@@ -1971,11 +2053,12 @@ public function bitpos($key, $bit, $start = 0, $end = null) {}
     public function bitCount($key) {}
 
     /**
-     * @see     lIndex()
-     *
      * @param   string $key
      * @param   int    $index
      *
+     * @throws  RedisClusterException
+     * @see     lIndex()
+     *
      * @link    https://redis.io/commands/lindex
      */
     public function lGet($key, $index) {}
@@ -1988,6 +2071,7 @@ public function lGet($key, $index) {}
      * @param   int    $end
      *
      * @return  string the substring
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/getrange
      * @example
      * 
@@ -2006,6 +2090,7 @@ public function getRange($key, $start, $end) {}
      * @param int    $stop
      *
      * @return array|false    Bool return FALSE if the key identify a non-list value.
+     * @throws RedisClusterException
      * @link        https://redis.io/commands/ltrim
      * @example
      * 
@@ -2029,6 +2114,7 @@ public function lTrim($key, $start, $stop) {}
      * @param   int    $end
      *
      * @return  array containing the values in specified range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/lrange
      * @example
      * 
@@ -2048,6 +2134,7 @@ public function lRange($key, $start, $end) {}
      * @param   int    $end
      *
      * @return  int     The number of values deleted from the sorted set
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zremrangebyrank
      * @example
      * 
@@ -2066,8 +2153,9 @@ public function zRemRangeByRank($key, $start, $end) {}
      * @param   string $channel a channel to publish to
      * @param   string $message string
      *
-     * @link    https://redis.io/commands/publish
      * @return  int Number of clients that received the message
+     * @throws  RedisClusterException
+     * @link    https://redis.io/commands/publish
      * @example $redisCluster->publish('chan-1', 'hello, world!'); // send message.
      */
     public function publish($channel, $message) {}
@@ -2079,6 +2167,7 @@ public function publish($channel, $message) {}
      * @param   string $dstKey
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/rename
      * @example
      * 
@@ -2100,6 +2189,7 @@ public function rename($srcKey, $dstKey) {}
      * @param   string $dstKey
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/renamenx
      * @example
      * 
@@ -2118,6 +2208,7 @@ public function renameNx($srcKey, $dstKey) {}
      * @param   string|array $key
      *
      * @return  int
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pfcount
      * @example
      * 
@@ -2136,6 +2227,7 @@ public function pfCount($key) {}
      * @param   array  $elements
      *
      * @return  bool
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pfadd
      * @example $redisCluster->pfAdd('key', array('elem1', 'elem2'))
      */
@@ -2149,6 +2241,7 @@ public function pfAdd($key, array $elements) {}
      * @param   array  $sourceKeys
      *
      * @return  bool
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pfmerge
      * @example
      * 
@@ -2168,6 +2261,7 @@ public function pfMerge($destKey, array $sourceKeys) {}
      * @param   string $value
      *
      * @return  string the length of the string after it was modified.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/setrange
      * @example
      * 
@@ -2186,6 +2280,7 @@ public function setRange($key, $offset, $value) {}
      * @param   string $value (binary).  The Redis encoded key value (from DUMP)
      *
      * @return  bool
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/restore
      * @example
      * 
@@ -2205,6 +2300,7 @@ public function restore($key, $ttl, $value) {}
      *
      * @return  bool    If the operation is successful, return TRUE.
      * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/smove
      * @example
      * 
@@ -2233,6 +2329,7 @@ public function sMove($srcKey, $dstKey, $member) {}
      * @param   bool   $withscores
      *
      * @return  array   Array containing the values in specified range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zrange
      * @example
      * 
@@ -2260,6 +2357,7 @@ public function zRange($key, $start, $end, $withscores = null) {}
      * @param   bool   $withscore
      *
      * @return  array   Array containing the values in specified range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zrevrange
      * @example
      * 
@@ -2289,6 +2387,7 @@ public function zRevRange($key, $start, $end, $withscore = null) {}
      *                          - and limit => array($offset, $count)
      *
      * @return  array   Array containing the values in specified range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zrangebyscore
      * @example
      * 
@@ -2310,14 +2409,15 @@ public function zRevRange($key, $start, $end, $withscore = null) {}
     public function zRangeByScore($key, $start, $end, array $options = []) {}
 
     /**
-     * @see zRangeByScore()
-     *
      * @param   string $key
      * @param   int    $start
      * @param   int    $end
      * @param   array  $options
      *
-     * @return    array
+     * @return  array
+     * @throws  RedisClusterException
+     * @see     zRangeByScore()
+     *
      */
     public function zRevRangeByScore($key, $start, $end, array $options = []) {}
 
@@ -2331,6 +2431,7 @@ public function zRevRangeByScore($key, $start, $end, array $options = []) {}
      * @param   int    $limit  Optional argument if you wish to limit the number of elements returned.
      *
      * @return  array   Array containing the values in the specified range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zrangebylex
      * @example
      * 
@@ -2346,8 +2447,6 @@ public function zRevRangeByScore($key, $start, $end, array $options = []) {}
     public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) {}
 
     /**
-     * @see     zRangeByLex()
-     *
      * @param   string $key
      * @param   int    $min
      * @param   int    $max
@@ -2355,6 +2454,9 @@ public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) {}
      * @param   int    $limit
      *
      * @return  array
+     * @throws  RedisClusterException
+     * @see     zRangeByLex()
+     *
      * @link    https://redis.io/commands/zrevrangebylex
      */
     public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) {}
@@ -2367,6 +2469,7 @@ public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null)
      * @param   int    $max
      *
      * @return  int The number of elements in the specified score range.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zlexcount
      * @example
      * 
@@ -2386,6 +2489,7 @@ public function zLexCount($key, $min, $max) {}
      * @param  string  $max  The maximum alphanumeric value you wish to get.
      *
      * @return  int|false    the number of elements removed.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zremrangebylex
      * @example
      * 
@@ -2408,7 +2512,8 @@ public function zRemRangeByLex(string $key, string $min, string $max) {}
      *                                  duplicate entries during the zUnion.
      *
      * @return int The number of values in the new sorted set.
-     * @link    https://redis.io/commands/zunionstore
+     * @throws RedisClusterException
+     * @link   https://redis.io/commands/zunionstore
      * @example
      * 
      * $redisCluster->del('k1');
@@ -2443,6 +2548,7 @@ public function zUnionStore($Output, $ZSetKeys, ?array $Weights = null, $aggrega
      *                                    defines the behaviour to use on duplicate entries during the zInterStore.
      *
      * @return  int     The number of values in the new sorted set.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zinterstore
      * @example
      * 
@@ -2481,6 +2587,7 @@ public function zInterStore($Output, $ZSetKeys, array $Weights = null, $aggregat
      * @param   string $memberN
      *
      * @return  int     Number of deleted values
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zrem
      * @example
      * 
@@ -2510,6 +2617,7 @@ public function zRem($key, $member1, $member2 = null, $memberN = null) {}
      *                         - 'store' => 'external-key'
      *
      * @return  array
+     * @throws  RedisClusterException
      * An array of values, or a number corresponding to the number of elements stored if that was used.
      * @link    https://redis.io/commands/sort
      * @example
@@ -2540,6 +2648,7 @@ public function sort($key, $option = null) {}
      * @param   string $key
      *
      * @return  string|false  for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/object
      * @example
      * 
@@ -2559,6 +2668,7 @@ public function object($string = '', $key = '') {}
      *                                 name, and the message.
      *
      * @return mixed            Any non-null return value in the callback will be returned to the caller.
+     * @throws RedisClusterException
      * @link    https://redis.io/commands/subscribe
      * @example
      * 
@@ -2591,6 +2701,7 @@ public function subscribe($channels, $callback) {}
      *                                       The callback will get four arguments ($redis, $pattern, $channel, $message)
      *
      * @return  mixed           Any non-null return value in the callback will be returned to the caller.
+     * @throws  RedisClusterException
      *
      * @link    https://redis.io/commands/psubscribe
      * @example
@@ -2609,6 +2720,8 @@ public function psubscribe($patterns, $callback) {}
      *
      * @param $channels
      * @param $callback
+     *
+     * @throws RedisClusterException     
      */
     public function unSubscribe($channels, $callback) {}
 
@@ -2617,6 +2730,8 @@ public function unSubscribe($channels, $callback) {}
      *
      * @param $channels
      * @param $callback
+     *
+     * @throws RedisClusterException     
      */
     public function punSubscribe($channels, $callback) {}
 
@@ -2630,6 +2745,7 @@ public function punSubscribe($channels, $callback) {}
      * @param   int    $numKeys
      *
      * @return  mixed   @see eval()
+     * @throws  RedisClusterException
      * @see     eval()
      * @link    https://redis.io/commands/evalsha
      * @example
@@ -2650,6 +2766,7 @@ public function evalSha($scriptSha, $args = [], $numKeys = 0) {}
      * @param  int          $count     Count of keys per iteration (only a suggestion to Redis).
      *
      * @return array|false             This function will return an array of keys or FALSE if there are no more keys.
+     * @throws RedisClusterException
      * @link   https://redis.io/commands/scan
      * @example
      * 
@@ -2672,6 +2789,7 @@ public function scan(&$iterator, $node, $pattern = null, $count = 0) {}
      * @param   int    $count    How many members to return at a time (Redis might return a different amount).
      *
      * @return  array|false   PHPRedis will return an array of keys or FALSE when we're done iterating.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/sscan
      * @example
      * 
@@ -2694,6 +2812,7 @@ public function sScan($key, &$iterator, $pattern = null, $count = 0) {}
      * @param   int    $count    How many keys to return per iteration (Redis might return a different number).
      *
      * @return  array|false   PHPRedis will return matching keys from Redis, or FALSE when iteration is complete.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/zscan
      * @example
      * 
@@ -2716,6 +2835,7 @@ public function zScan($key, &$iterator, $pattern = null, $count = 0) {}
      * @param   int    $count   How many keys to return in a go (only a sugestion to Redis).
      *
      * @return  array     An array of members that match our pattern.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/hscan
      * @example
      * 
@@ -2733,6 +2853,7 @@ public function hScan($key, &$iterator, $pattern = null, $count = 0) {}
      * Detect whether we're in ATOMIC/MULTI/PIPELINE mode.
      *
      * @return  int     Either RedisCluster::ATOMIC, RedisCluster::MULTI or RedisCluster::PIPELINE
+     * @throws  RedisClusterException
      * @example $redisCluster->getMode();
      */
     public function getMode() {}
@@ -2741,6 +2862,7 @@ public function getMode() {}
      * The last error message (if any)
      *
      * @return  string|null  A string with the last returned script based error message, or NULL if there is no error
+     * @throws  RedisClusterException
      * @example
      * 
      * $redisCluster->eval('this-is-not-lua');
@@ -2870,6 +2992,7 @@ public function _masters() {}
      *            of atomicity. discard cancels a transaction.
      *
      * @return RedisCluster returns the RedisCluster instance and enters multi-mode.
+     * @throws RedisClusterException
      * Once in multi-mode, all subsequent method calls return the same object until exec() is called.
      * @link    https://redis.io/commands/multi
      * @example
@@ -2891,9 +3014,10 @@ public function _masters() {}
     public function multi($mode = RedisCluster::MULTI) {}
 
     /**
-     * @see     multi()
      * @return void|array
-     * @link    https://redis.io/commands/exec
+     * @throws RedisClusterException
+     * @see    multi()
+     * @link   https://redis.io/commands/exec
      */
     public function exec() {}
 
@@ -2910,7 +3034,8 @@ public function discard() {}
      * @param string|array $key : a list of keys
      *
      * @return void
-     * @link    https://redis.io/commands/watch
+     * @throws RedisClusterException
+     * @link   https://redis.io/commands/watch
      * @example
      * 
      * $redisCluster->watch('x');
@@ -2926,6 +3051,7 @@ public function watch($key) {}
     /**
      * @see     watch()
      * @link    https://redis.io/commands/unwatch
+     * @throws  RedisClusterException     
      */
     public function unwatch() {}
 
@@ -2936,6 +3062,7 @@ public function unwatch() {}
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
      * If a save is already running, this command will fail and return FALSE.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/save
      * @example
      * $redisCluster->save('x'); //key
@@ -2950,6 +3077,7 @@ public function save($nodeParams) {}
      *
      * @return  bool    TRUE in case of success, FALSE in case of failure.
      * If a save is already running, this command will fail and return FALSE.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/bgsave
      */
     public function bgsave($nodeParams) {}
@@ -2960,6 +3088,7 @@ public function bgsave($nodeParams) {}
      * @param string|array $nodeParams key or [host,port]
      *
      * @return  bool Always TRUE.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/flushdb
      */
     public function flushDB($nodeParams) {}
@@ -2970,6 +3099,7 @@ public function flushDB($nodeParams) {}
      * @param string|array $nodeParams key or [host,port]
      *
      * @return  bool Always TRUE.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/flushall
      */
     public function flushAll($nodeParams) {}
@@ -2980,6 +3110,7 @@ public function flushAll($nodeParams) {}
      * @param string|array $nodeParams key or [host,port]
      *
      * @return int     DB size, in number of keys.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/dbsize
      * @example
      * 
@@ -2995,6 +3126,7 @@ public function dbSize($nodeParams) {}
      * @param string|array $nodeParams key or [host,port]
      *
      * @return  bool   TRUE in case of success, FALSE in case of failure.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/bgrewriteaof
      * @example $redisCluster->bgrewriteaof('x');
      */
@@ -3006,6 +3138,7 @@ public function bgrewriteaof($nodeParams) {}
      * @param string|array $nodeParams key or [host,port]
      *
      * @return  int    timestamp.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/lastsave
      * @example $redisCluster->lastSave('x');
      */
@@ -3150,8 +3283,9 @@ public function lastSave($nodeParams) {}
      * - used_cpu_user_children
      * - cluster_enabled
      *
-     * @link    https://redis.io/commands/info
      * @return  array
+     * @throws  RedisClusterException
+     * @link    https://redis.io/commands/info
      * @example
      * 
      * $redisCluster->info();
@@ -3165,12 +3299,12 @@ public function lastSave($nodeParams) {}
     public function info($option = null) {}
 
     /**
-     * @since  redis >= 2.8.12.
-     *  Returns the role of the instance in the context of replication
-     *
      * @param string|array $nodeParams key or [host,port]
      *
      * @return array
+     *   Returns the role of the instance in the context of replication
+     * @throws RedisClusterException
+     * @since  redis >= 2.8.12.
      * @link   https://redis.io/commands/role
      * @example
      * 
@@ -3186,6 +3320,7 @@ public function role($nodeParams) {}
      * @param string|array $nodeParams key or [host,port]
      *
      * @return string an existing key in redis.
+     * @throws RedisClusterException
      * @link    https://redis.io/commands/randomkey
      * @example
      * 
@@ -3202,6 +3337,7 @@ public function randomKey($nodeParams) {}
      *
      * @return  array If successfully, the time will come back as an associative array with element zero being the
      * unix timestamp, and element one being microseconds.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/time
      * @example
      * 
@@ -3223,6 +3359,7 @@ public function time($nodeParams) {}
      *
      * @return  string STRING: +PONG on success. Throws a RedisClusterException object on connectivity error, as described
      *                 above.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/ping
      */
     public function ping($nodeParams) {}
@@ -3234,6 +3371,7 @@ public function ping($nodeParams) {}
      * @param string        $msg
      *
      * @return mixed
+     * @throws RedisClusterException
      */
     public function echo($nodeParams, $msg) {}
 
@@ -3241,6 +3379,7 @@ public function echo($nodeParams, $msg) {}
      * Returns Array reply of details about all Redis Cluster commands.
      *
      * @return mixed array | bool
+     * @throws RedisClusterException
      */
     public function command() {}
 
@@ -3252,11 +3391,11 @@ public function command() {}
      * @param mixed        ...$arguments  Optional variable amount of arguments to send to the server.
      *
      * @return  mixed
+     * @throws  RedisClusterException
      */
     public function rawcommand($nodeParams, $command, ...$arguments) {}
 
     /**
-     * @since redis >= 3.0
      * Executes cluster command
      *
      * @param string|array $nodeParams key or [host,port]
@@ -3264,6 +3403,9 @@ public function rawcommand($nodeParams, $command, ...$arguments) {}
      * @param mixed        $arguments  Optional variable amount of arguments to send to the server.
      *
      * @return  mixed
+     * @throws  RedisClusterException
+     * @since redis >= 3.0
+     *
      * @link  https://redis.io/commands#cluster
      * @example
      * 
@@ -3278,6 +3420,8 @@ public function cluster($nodeParams, $command, $arguments) {}
      * @param string|array $nodeParams key or [host,port]
      * @param string       $subCmd     can be: 'LIST', 'KILL', 'GETNAME', or 'SETNAME'
      * @param string       $args       optional arguments
+     *
+     * @throws  RedisClusterException
      */
     public function client($nodeParams, $subCmd, $args) {}
 
@@ -3290,6 +3434,7 @@ public function client($nodeParams, $subCmd, $args) {}
      * @param string       $value      optional string (only for `SET`)
      *
      * @return  array   Associative array for `GET`, key -> value
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/config-get
      * @link    https://redis.io/commands/config-set
      * @example
@@ -3315,6 +3460,7 @@ public function config($nodeParams, $operation, $key, $value) {}
      *                          - numsub    Returns a key/value array where the keys are channel names and
      *                                      values are their counts.
      *                          - numpat    Integer return containing the number active pattern subscriptions.
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/pubsub
      * @example
      * 
@@ -3335,6 +3481,7 @@ public function pubsub($nodeParams, $keyword, $argument) {}
      * @param   string       $script
      *
      * @return  mixed
+     * @throws  RedisClusterException
      * @link    https://redis.io/commands/script-load
      * @link    https://redis.io/commands/script-kill
      * @link    https://redis.io/commands/script-flush
@@ -3361,6 +3508,7 @@ public function script($nodeParams, $command, $script) {}
      * @param   string       $command
      * @param   mixed        $argument
      *
+     * @throws  RedisClusterException
      * @link  https://redis.io/commands/slowlog
      * @example
      * 
@@ -3377,6 +3525,7 @@ public function slowLog($nodeParams, $command, $argument) {}
      * @param float  $latitude
      * @param string $member
      *
+     * @throws  RedisClusterException
      * @link  https://redis.io/commands/geoadd
      * @example
      * 
@@ -3394,6 +3543,7 @@ public function geoAdd($key, $longitude, $latitude, $member) {}
      * @param string $member2
      * @param string $memberN
      *
+     * @throws  RedisClusterException
      * @example
      * 
      * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
@@ -3410,6 +3560,8 @@ public function geohash($key, $member1, $member2 = null, $memberN = null) {}
      * @param string $member1
      * @param string $member2
      * @param string $memberN
+     *
+     * @throws  RedisClusterException
      * @example
      * 
      * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
@@ -3430,6 +3582,7 @@ public function geopos($key, $member1, $member2 = null, $memberN = null) {}
      *                        mi for miles.
      *                        ft for feet.
      *
+     * @throws  RedisClusterException
      * @link https://redis.io/commands/geoadd
      * @example
      * 
@@ -3451,6 +3604,7 @@ public function geoDist($key, $member1, $member2, $unit = 'm') {}
      * @param    string $radiusUnit String can be: "m" for meters; "km" for kilometers , "mi" for miles, or "ft" for feet.
      * @param    array  $options
      *
+     * @throws  RedisClusterException
      * @link  https://redis.io/commands/georadius
      * @example
      * 
@@ -3510,13 +3664,14 @@ public function geoRadius($key, $longitude, $latitude, $radius, $radiusUnit, arr
     /**
      * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
      *
-     * @see geoRadius
-     *
      * @param string $key
      * @param string $member
      * @param float  $radius
      * @param string $radiusUnit
      * @param array  $options
+     *
+     * @throws  RedisClusterException
+     * @see geoRadius
      */
     public function geoRadiusByMember($key, $member, $radius, $radiusUnit, array $options) {}
 }

From 23e512aa5a14b183c015c66ec62da4f9d4a75ab8 Mon Sep 17 00:00:00 2001
From: BigBadBassMan 
Date: Wed, 14 May 2025 08:38:59 +0200
Subject: [PATCH 2/2] fix(types)!: RedisCluster::sPop fix type hint

---
 redis/RedisCluster.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/redis/RedisCluster.php b/redis/RedisCluster.php
index 7fda124b4..a39dfbfed 100644
--- a/redis/RedisCluster.php
+++ b/redis/RedisCluster.php
@@ -413,7 +413,7 @@ public function lSet($key, $index, $value) {}
      *
      * @param   string $key
      *
-     * @return  string  "popped" value, bool FALSE if set identified by key is empty or doesn't exist.
+     * @return  string|false  "popped" value, bool FALSE if set identified by key is empty or doesn't exist.
      * @throws  RedisClusterException
      * @link    https://redis.io/commands/spop
      * @example