Fix PHP 8.4 implicit nullable parameter deprecations in Predis library

PHP 8.4 deprecates implicitly nullable parameter types. Parameters with a default value of `null` must now be explicitly marked as nullable (e.g., `?Type $var = null`).

This change updates the vendored `Predis` library in `plugins/cache-redis/` to comply with this requirement. It scans for function signatures like `Type $var = null` and updates them to `?Type $var = null`. This ensures compatibility with PHP 8.4 and PHP 8.5 while maintaining backward compatibility.

Affected files include `Predis` interfaces, connection classes, and command definitions.
Also updated PHPDoc `@method` annotations to reflect nullable types.
This commit is contained in:
google-labs-jules[bot] 2026-01-16 15:11:52 +00:00
parent c95f5fcf98
commit 2548ed59da
15 changed files with 52 additions and 52 deletions

View file

@ -65,8 +65,8 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this randomkey() * @method $this randomkey()
* @method $this rename($key, $target) * @method $this rename($key, $target)
* @method $this renamenx($key, $target) * @method $this renamenx($key, $target)
* @method $this scan($cursor, array $options = null) * @method $this scan($cursor, ?array $options = null)
* @method $this sort($key, array $options = null) * @method $this sort($key, ?array $options = null)
* @method $this sort_ro(string $key, ?string $byPattern = null, ?LimitOffsetCount $limit = null, array $getPatterns = [], ?string $sorting = null, bool $alpha = false) * @method $this sort_ro(string $key, ?string $byPattern = null, ?LimitOffsetCount $limit = null, array $getPatterns = [], ?string $sorting = null, bool $alpha = false)
* @method $this ttl($key) * @method $this ttl($key)
* @method $this type($key) * @method $this type($key)
@ -163,7 +163,7 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this hmget($key, array $fields) * @method $this hmget($key, array $fields)
* @method $this hmset($key, array $dictionary) * @method $this hmset($key, array $dictionary)
* @method $this hrandfield(string $key, int $count = 1, bool $withValues = false) * @method $this hrandfield(string $key, int $count = 1, bool $withValues = false)
* @method $this hscan($key, $cursor, array $options = null) * @method $this hscan($key, $cursor, ?array $options = null)
* @method $this hset($key, $field, $value) * @method $this hset($key, $field, $value)
* @method $this hsetnx($key, $field, $value) * @method $this hsetnx($key, $field, $value)
* @method $this hvals($key) * @method $this hvals($key)
@ -225,7 +225,7 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this spop($key, $count = null) * @method $this spop($key, $count = null)
* @method $this srandmember($key, $count = null) * @method $this srandmember($key, $count = null)
* @method $this srem($key, $member) * @method $this srem($key, $member)
* @method $this sscan($key, $cursor, array $options = null) * @method $this sscan($key, $cursor, ?array $options = null)
* @method $this sunion(array|string $keys) * @method $this sunion(array|string $keys)
* @method $this sunionstore($destination, array|string $keys) * @method $this sunionstore($destination, array|string $keys)
* @method $this tdigestadd(string $key, float ...$value) * @method $this tdigestadd(string $key, float ...$value)
@ -255,7 +255,7 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this tsdecrby(string $key, float $value, ?DecrByArguments $arguments = null) * @method $this tsdecrby(string $key, float $value, ?DecrByArguments $arguments = null)
* @method $this tsdel(string $key, int $fromTimestamp, int $toTimestamp) * @method $this tsdel(string $key, int $fromTimestamp, int $toTimestamp)
* @method $this tsdeleterule(string $sourceKey, string $destKey) * @method $this tsdeleterule(string $sourceKey, string $destKey)
* @method $this tsget(string $key, GetArguments $arguments = null) * @method $this tsget(string $key, ?GetArguments $arguments = null)
* @method $this tsincrby(string $key, float $value, ?IncrByArguments $arguments = null) * @method $this tsincrby(string $key, float $value, ?IncrByArguments $arguments = null)
* @method $this tsinfo(string $key, ?InfoArguments $arguments = null) * @method $this tsinfo(string $key, ?InfoArguments $arguments = null)
* @method $this tsmadd(mixed ...$keyTimestampValue) * @method $this tsmadd(mixed ...$keyTimestampValue)
@ -277,22 +277,22 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this zmpop(array $keys, string $modifier = 'min', int $count = 1) * @method $this zmpop(array $keys, string $modifier = 'min', int $count = 1)
* @method $this zmscore(string $key, string ...$member) * @method $this zmscore(string $key, string ...$member)
* @method $this zrandmember(string $key, int $count = 1, bool $withScores = false) * @method $this zrandmember(string $key, int $count = 1, bool $withScores = false)
* @method $this zrange($key, $start, $stop, array $options = null) * @method $this zrange($key, $start, $stop, ?array $options = null)
* @method $this zrangebyscore($key, $min, $max, array $options = null) * @method $this zrangebyscore($key, $min, $max, ?array $options = null)
* @method $this zrangestore(string $destination, string $source, int|string $min, string|int $max, string|bool $by = false, bool $reversed = false, bool $limit = false, int $offset = 0, int $count = 0) * @method $this zrangestore(string $destination, string $source, int|string $min, string|int $max, string|bool $by = false, bool $reversed = false, bool $limit = false, int $offset = 0, int $count = 0)
* @method $this zrank($key, $member) * @method $this zrank($key, $member)
* @method $this zrem($key, $member) * @method $this zrem($key, $member)
* @method $this zremrangebyrank($key, $start, $stop) * @method $this zremrangebyrank($key, $start, $stop)
* @method $this zremrangebyscore($key, $min, $max) * @method $this zremrangebyscore($key, $min, $max)
* @method $this zrevrange($key, $start, $stop, array $options = null) * @method $this zrevrange($key, $start, $stop, ?array $options = null)
* @method $this zrevrangebyscore($key, $max, $min, array $options = null) * @method $this zrevrangebyscore($key, $max, $min, ?array $options = null)
* @method $this zrevrank($key, $member) * @method $this zrevrank($key, $member)
* @method $this zunion(array $keys, int[] $weights = [], string $aggregate = 'sum', bool $withScores = false) * @method $this zunion(array $keys, int[] $weights = [], string $aggregate = 'sum', bool $withScores = false)
* @method $this zunionstore(string $destination, array $keys, int[] $weights = [], string $aggregate = 'sum') * @method $this zunionstore(string $destination, array $keys, int[] $weights = [], string $aggregate = 'sum')
* @method $this zscore($key, $member) * @method $this zscore($key, $member)
* @method $this zscan($key, $cursor, array $options = null) * @method $this zscan($key, $cursor, ?array $options = null)
* @method $this zrangebylex($key, $start, $stop, array $options = null) * @method $this zrangebylex($key, $start, $stop, ?array $options = null)
* @method $this zrevrangebylex($key, $start, $stop, array $options = null) * @method $this zrevrangebylex($key, $start, $stop, ?array $options = null)
* @method $this zremrangebylex($key, $min, $max) * @method $this zremrangebylex($key, $min, $max)
* @method $this zlexcount($key, $min, $max) * @method $this zlexcount($key, $min, $max)
* @method $this pexpiretime(string $key) * @method $this pexpiretime(string $key)
@ -312,7 +312,7 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this evalsha($script, $numkeys, $keyOrArg1 = null, $keyOrArgN = null) * @method $this evalsha($script, $numkeys, $keyOrArg1 = null, $keyOrArgN = null)
* @method $this evalsha_ro(string $sha1, array $keys, ...$argument) * @method $this evalsha_ro(string $sha1, array $keys, ...$argument)
* @method $this script($subcommand, $argument = null) * @method $this script($subcommand, $argument = null)
* @method $this shutdown(bool $noSave = null, bool $now = false, bool $force = false, bool $abort = false) * @method $this shutdown(?bool $noSave = null, bool $now = false, bool $force = false, bool $abort = false)
* @method $this auth($password) * @method $this auth($password)
* @method $this echo($message) * @method $this echo($message)
* @method $this ping($message = null) * @method $this ping($message = null)
@ -335,8 +335,8 @@ use Predis\Command\Redis\Container\Search\FTCURSOR;
* @method $this geohash($key, array $members) * @method $this geohash($key, array $members)
* @method $this geopos($key, array $members) * @method $this geopos($key, array $members)
* @method $this geodist($key, $member1, $member2, $unit = null) * @method $this geodist($key, $member1, $member2, $unit = null)
* @method $this georadius($key, $longitude, $latitude, $radius, $unit, array $options = null) * @method $this georadius($key, $longitude, $latitude, $radius, $unit, ?array $options = null)
* @method $this georadiusbymember($key, $member, $radius, $unit, array $options = null) * @method $this georadiusbymember($key, $member, $radius, $unit, ?array $options = null)
* @method $this geosearch(string $key, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $withCoord = false, bool $withDist = false, bool $withHash = false) * @method $this geosearch(string $key, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $withCoord = false, bool $withDist = false, bool $withHash = false)
* @method $this geosearchstore(string $destination, string $source, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $storeDist = false) * @method $this geosearchstore(string $destination, string $source, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $storeDist = false)
* *

View file

@ -74,8 +74,8 @@ use Predis\Response\Status;
* @method string|null randomkey() * @method string|null randomkey()
* @method mixed rename(string $key, string $target) * @method mixed rename(string $key, string $target)
* @method int renamenx(string $key, string $target) * @method int renamenx(string $key, string $target)
* @method array scan($cursor, array $options = null) * @method array scan($cursor, ?array $options = null)
* @method array sort(string $key, array $options = null) * @method array sort(string $key, ?array $options = null)
* @method array sort_ro(string $key, ?string $byPattern = null, ?LimitOffsetCount $limit = null, array $getPatterns = [], ?string $sorting = null, bool $alpha = false) * @method array sort_ro(string $key, ?string $byPattern = null, ?LimitOffsetCount $limit = null, array $getPatterns = [], ?string $sorting = null, bool $alpha = false)
* @method int ttl(string $key) * @method int ttl(string $key)
* @method mixed type(string $key) * @method mixed type(string $key)
@ -172,7 +172,7 @@ use Predis\Response\Status;
* @method array hmget(string $key, array $fields) * @method array hmget(string $key, array $fields)
* @method mixed hmset(string $key, array $dictionary) * @method mixed hmset(string $key, array $dictionary)
* @method array hrandfield(string $key, int $count = 1, bool $withValues = false) * @method array hrandfield(string $key, int $count = 1, bool $withValues = false)
* @method array hscan(string $key, $cursor, array $options = null) * @method array hscan(string $key, $cursor, ?array $options = null)
* @method int hset(string $key, string $field, string $value) * @method int hset(string $key, string $field, string $value)
* @method int hsetnx(string $key, string $field, string $value) * @method int hsetnx(string $key, string $field, string $value)
* @method array hvals(string $key) * @method array hvals(string $key)
@ -231,10 +231,10 @@ use Predis\Response\Status;
* @method string[] smembers(string $key) * @method string[] smembers(string $key)
* @method array smismember(string $key, string ...$members) * @method array smismember(string $key, string ...$members)
* @method int smove(string $source, string $destination, string $member) * @method int smove(string $source, string $destination, string $member)
* @method string|array|null spop(string $key, int $count = null) * @method string|array|null spop(string $key, ?int $count = null)
* @method string|null srandmember(string $key, int $count = null) * @method string|null srandmember(string $key, ?int $count = null)
* @method int srem(string $key, array|string $member) * @method int srem(string $key, array|string $member)
* @method array sscan(string $key, int $cursor, array $options = null) * @method array sscan(string $key, int $cursor, ?array $options = null)
* @method string[] sunion(array|string $keys) * @method string[] sunion(array|string $keys)
* @method int sunionstore(string $destination, array|string $keys) * @method int sunionstore(string $destination, array|string $keys)
* @method int touch(string[]|string $keyOrKeys, string ...$keys = null) * @method int touch(string[]|string $keyOrKeys, string ...$keys = null)
@ -265,7 +265,7 @@ use Predis\Response\Status;
* @method int tsdecrby(string $key, float $value, ?DecrByArguments $arguments = null) * @method int tsdecrby(string $key, float $value, ?DecrByArguments $arguments = null)
* @method int tsdel(string $key, int $fromTimestamp, int $toTimestamp) * @method int tsdel(string $key, int $fromTimestamp, int $toTimestamp)
* @method Status tsdeleterule(string $sourceKey, string $destKey) * @method Status tsdeleterule(string $sourceKey, string $destKey)
* @method array tsget(string $key, GetArguments $arguments = null) * @method array tsget(string $key, ?GetArguments $arguments = null)
* @method int tsincrby(string $key, float $value, ?IncrByArguments $arguments = null) * @method int tsincrby(string $key, float $value, ?IncrByArguments $arguments = null)
* @method array tsinfo(string $key, ?InfoArguments $arguments = null) * @method array tsinfo(string $key, ?InfoArguments $arguments = null)
* @method array tsmadd(mixed ...$keyTimestampValue) * @method array tsmadd(mixed ...$keyTimestampValue)
@ -275,12 +275,12 @@ use Predis\Response\Status;
* @method array tsqueryindex(string ...$filterExpression) * @method array tsqueryindex(string ...$filterExpression)
* @method array tsrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null) * @method array tsrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null)
* @method array tsrevrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null) * @method array tsrevrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null)
* @method string xadd(string $key, array $dictionary, string $id = '*', array $options = null) * @method string xadd(string $key, array $dictionary, string $id = '*', ?array $options = null)
* @method int xdel(string $key, string ...$id) * @method int xdel(string $key, string ...$id)
* @method int xlen(string $key) * @method int xlen(string $key)
* @method array xrevrange(string $key, string $end, string $start, ?int $count = null) * @method array xrevrange(string $key, string $end, string $start, ?int $count = null)
* @method array xrange(string $key, string $start, string $end, ?int $count = null) * @method array xrange(string $key, string $start, string $end, ?int $count = null)
* @method string xtrim(string $key, array|string $strategy, string $threshold, array $options = null) * @method string xtrim(string $key, array|string $strategy, string $threshold, ?array $options = null)
* @method int zadd(string $key, array $membersAndScoresDictionary) * @method int zadd(string $key, array $membersAndScoresDictionary)
* @method int zcard(string $key) * @method int zcard(string $key)
* @method string zcount(string $key, int|string $min, int|string $max) * @method string zcount(string $key, int|string $min, int|string $max)
@ -295,22 +295,22 @@ use Predis\Response\Status;
* @method array zpopmin(string $key, int $count = 1) * @method array zpopmin(string $key, int $count = 1)
* @method array zpopmax(string $key, int $count = 1) * @method array zpopmax(string $key, int $count = 1)
* @method mixed zrandmember(string $key, int $count = 1, bool $withScores = false) * @method mixed zrandmember(string $key, int $count = 1, bool $withScores = false)
* @method array zrange(string $key, int|string $start, int|string $stop, array $options = null) * @method array zrange(string $key, int|string $start, int|string $stop, ?array $options = null)
* @method array zrangebyscore(string $key, int|string $min, int|string $max, array $options = null) * @method array zrangebyscore(string $key, int|string $min, int|string $max, ?array $options = null)
* @method int zrangestore(string $destination, string $source, int|string $min, int|string $max, string|bool $by = false, bool $reversed = false, bool $limit = false, int $offset = 0, int $count = 0) * @method int zrangestore(string $destination, string $source, int|string $min, int|string $max, string|bool $by = false, bool $reversed = false, bool $limit = false, int $offset = 0, int $count = 0)
* @method int|null zrank(string $key, string $member) * @method int|null zrank(string $key, string $member)
* @method int zrem(string $key, string ...$member) * @method int zrem(string $key, string ...$member)
* @method int zremrangebyrank(string $key, int|string $start, int|string $stop) * @method int zremrangebyrank(string $key, int|string $start, int|string $stop)
* @method int zremrangebyscore(string $key, int|string $min, int|string $max) * @method int zremrangebyscore(string $key, int|string $min, int|string $max)
* @method array zrevrange(string $key, int|string $start, int|string $stop, array $options = null) * @method array zrevrange(string $key, int|string $start, int|string $stop, ?array $options = null)
* @method array zrevrangebyscore(string $key, int|string $max, int|string $min, array $options = null) * @method array zrevrangebyscore(string $key, int|string $max, int|string $min, ?array $options = null)
* @method int|null zrevrank(string $key, string $member) * @method int|null zrevrank(string $key, string $member)
* @method array zunion(array $keys, int[] $weights = [], string $aggregate = 'sum', bool $withScores = false) * @method array zunion(array $keys, int[] $weights = [], string $aggregate = 'sum', bool $withScores = false)
* @method int zunionstore(string $destination, array $keys, int[] $weights = [], string $aggregate = 'sum') * @method int zunionstore(string $destination, array $keys, int[] $weights = [], string $aggregate = 'sum')
* @method string|null zscore(string $key, string $member) * @method string|null zscore(string $key, string $member)
* @method array zscan(string $key, int $cursor, array $options = null) * @method array zscan(string $key, int $cursor, ?array $options = null)
* @method array zrangebylex(string $key, string $start, string $stop, array $options = null) * @method array zrangebylex(string $key, string $start, string $stop, ?array $options = null)
* @method array zrevrangebylex(string $key, string $start, string $stop, array $options = null) * @method array zrevrangebylex(string $key, string $start, string $stop, ?array $options = null)
* @method int zremrangebylex(string $key, string $min, string $max) * @method int zremrangebylex(string $key, string $min, string $max)
* @method int zlexcount(string $key, string $min, string $max) * @method int zlexcount(string $key, string $min, string $max)
* @method int pexpiretime(string $key) * @method int pexpiretime(string $key)
@ -330,10 +330,10 @@ use Predis\Response\Status;
* @method mixed evalsha(string $script, int $numkeys, string ...$keyOrArg = null) * @method mixed evalsha(string $script, int $numkeys, string ...$keyOrArg = null)
* @method mixed evalsha_ro(string $sha1, array $keys, ...$argument) * @method mixed evalsha_ro(string $sha1, array $keys, ...$argument)
* @method mixed script($subcommand, $argument = null) * @method mixed script($subcommand, $argument = null)
* @method Status shutdown(bool $noSave = null, bool $now = false, bool $force = false, bool $abort = false) * @method Status shutdown(?bool $noSave = null, bool $now = false, bool $force = false, bool $abort = false)
* @method mixed auth(string $password) * @method mixed auth(string $password)
* @method string echo(string $message) * @method string echo(string $message)
* @method mixed ping(string $message = null) * @method mixed ping(?string $message = null)
* @method mixed select(int $database) * @method mixed select(int $database)
* @method mixed bgrewriteaof() * @method mixed bgrewriteaof()
* @method mixed bgsave() * @method mixed bgsave()
@ -353,8 +353,8 @@ use Predis\Response\Status;
* @method array geohash(string $key, array $members) * @method array geohash(string $key, array $members)
* @method array geopos(string $key, array $members) * @method array geopos(string $key, array $members)
* @method string|null geodist(string $key, $member1, $member2, $unit = null) * @method string|null geodist(string $key, $member1, $member2, $unit = null)
* @method array georadius(string $key, $longitude, $latitude, $radius, $unit, array $options = null) * @method array georadius(string $key, $longitude, $latitude, $radius, $unit, ?array $options = null)
* @method array georadiusbymember(string $key, $member, $radius, $unit, array $options = null) * @method array georadiusbymember(string $key, $member, $radius, $unit, ?array $options = null)
* @method array geosearch(string $key, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $withCoord = false, bool $withDist = false, bool $withHash = false) * @method array geosearch(string $key, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $withCoord = false, bool $withDist = false, bool $withHash = false)
* @method int geosearchstore(string $destination, string $source, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $storeDist = false) * @method int geosearchstore(string $destination, string $source, FromInterface $from, ByInterface $by, ?string $sorting = null, int $count = -1, bool $any = false, bool $storeDist = false)
* *

View file

@ -25,7 +25,7 @@ class PredisStrategy extends ClusterStrategy
/** /**
* @param DistributorInterface $distributor Optional distributor instance. * @param DistributorInterface $distributor Optional distributor instance.
*/ */
public function __construct(DistributorInterface $distributor = null) public function __construct(?DistributorInterface $distributor = null)
{ {
parent::__construct(); parent::__construct();

View file

@ -27,7 +27,7 @@ class RedisStrategy extends ClusterStrategy
/** /**
* @param HashGeneratorInterface $hashGenerator Hash generator instance. * @param HashGeneratorInterface $hashGenerator Hash generator instance.
*/ */
public function __construct(HashGeneratorInterface $hashGenerator = null) public function __construct(?HashGeneratorInterface $hashGenerator = null)
{ {
parent::__construct(); parent::__construct();

View file

@ -19,9 +19,9 @@ use Predis\Response\Status;
* @method string dump() * @method string dump()
* @method Status flush(?string $mode = null) * @method Status flush(?string $mode = null)
* @method Status kill() * @method Status kill()
* @method array list(string $libraryNamePattern = null, bool $withCode = false) * @method array list(?string $libraryNamePattern = null, bool $withCode = false)
* @method string load(string $functionCode, bool $replace = 'false') * @method string load(string $functionCode, bool $replace = 'false')
* @method Status restore(string $value, string $policy = null) * @method Status restore(string $value, ?string $policy = null)
* @method array stats() * @method array stats()
*/ */
class FunctionContainer extends AbstractContainer class FunctionContainer extends AbstractContainer

View file

@ -23,7 +23,7 @@ class SubcommandStrategyResolver implements StrategyResolverInterface
*/ */
private $separator; private $separator;
public function __construct(string $separator = null) public function __construct(?string $separator = null)
{ {
$this->separator = $separator; $this->separator = $separator;
} }

View file

@ -32,7 +32,7 @@ abstract class CommunicationException extends PredisException
NodeConnectionInterface $connection, NodeConnectionInterface $connection,
$message = '', $message = '',
$code = 0, $code = 0,
Exception $innerException = null ?Exception $innerException = null
) { ) {
parent::__construct( parent::__construct(
is_null($message) ? '' : $message, is_null($message) ? '' : $message,

View file

@ -43,7 +43,7 @@ class Options implements OptionsInterface
/** /**
* @param array $options Named array of client options * @param array $options Named array of client options
*/ */
public function __construct(array $options = null) public function __construct(?array $options = null)
{ {
$this->input = $options ?? []; $this->input = $options ?? [];
} }

View file

@ -52,7 +52,7 @@ class PredisCluster implements ClusterInterface, IteratorAggregate, Countable
/** /**
* @param StrategyInterface $strategy Optional cluster strategy. * @param StrategyInterface $strategy Optional cluster strategy.
*/ */
public function __construct(StrategyInterface $strategy = null) public function __construct(?StrategyInterface $strategy = null)
{ {
$this->strategy = $strategy ?: new PredisStrategy(); $this->strategy = $strategy ?: new PredisStrategy();
$this->distributor = $this->strategy->getDistributor(); $this->distributor = $this->strategy->getDistributor();

View file

@ -70,7 +70,7 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
*/ */
public function __construct( public function __construct(
FactoryInterface $connections, FactoryInterface $connections,
StrategyInterface $strategy = null ?StrategyInterface $strategy = null
) { ) {
$this->connections = $connections; $this->connections = $connections;
$this->strategy = $strategy ?: new RedisClusterStrategy(); $this->strategy = $strategy ?: new RedisClusterStrategy();
@ -273,7 +273,7 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
* *
* @param NodeConnectionInterface $connection Optional connection instance. * @param NodeConnectionInterface $connection Optional connection instance.
*/ */
public function askSlotMap(NodeConnectionInterface $connection = null) public function askSlotMap(?NodeConnectionInterface $connection = null)
{ {
if (!$connection && !$connection = $this->getRandomConnection()) { if (!$connection && !$connection = $this->getRandomConnection()) {
return; return;

View file

@ -31,7 +31,7 @@ class CompositeStreamConnection extends StreamConnection implements CompositeCon
*/ */
public function __construct( public function __construct(
ParametersInterface $parameters, ParametersInterface $parameters,
ProtocolProcessorInterface $protocol = null ?ProtocolProcessorInterface $protocol = null
) { ) {
$this->parameters = $this->assertParameters($parameters); $this->parameters = $this->assertParameters($parameters);
$this->protocol = $protocol ?: new TextProtocolProcessor(); $this->protocol = $protocol ?: new TextProtocolProcessor();

View file

@ -32,7 +32,7 @@ trait RelayMethods
* @param string $pattern * @param string $pattern
* @return bool * @return bool
*/ */
public function onInvalidated(?callable $callback, string $pattern = null) public function onInvalidated(?callable $callback, ?string $pattern = null)
{ {
return $this->client->onInvalidated($callback, $pattern); return $this->client->onInvalidated($callback, $pattern);
} }
@ -129,7 +129,7 @@ trait RelayMethods
* @param ?int $db * @param ?int $db
* @return bool * @return bool
*/ */
public function flushMemory(string $endpointId = null, int $db = null) public function flushMemory(?string $endpointId = null, ?int $db = null)
{ {
return $this->client->flushMemory($endpointId, $db); return $this->client->flushMemory($endpointId, $db);
} }

View file

@ -72,7 +72,7 @@ class MasterSlaveReplication implements ReplicationInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct(ReplicationStrategy $strategy = null) public function __construct(?ReplicationStrategy $strategy = null)
{ {
$this->strategy = $strategy ?: new ReplicationStrategy(); $this->strategy = $strategy ?: new ReplicationStrategy();
} }

View file

@ -123,7 +123,7 @@ class SentinelReplication implements ReplicationInterface
$service, $service,
array $sentinels, array $sentinels,
ConnectionFactoryInterface $connectionFactory, ConnectionFactoryInterface $connectionFactory,
ReplicationStrategy $strategy = null ?ReplicationStrategy $strategy = null
) { ) {
$this->sentinels = $sentinels; $this->sentinels = $sentinels;
$this->service = $service; $this->service = $service;

View file

@ -41,8 +41,8 @@ class CompositeProtocolProcessor implements ProtocolProcessorInterface
* @param ResponseReaderInterface $reader Response reader. * @param ResponseReaderInterface $reader Response reader.
*/ */
public function __construct( public function __construct(
RequestSerializerInterface $serializer = null, ?RequestSerializerInterface $serializer = null,
ResponseReaderInterface $reader = null ?ResponseReaderInterface $reader = null
) { ) {
$this->setRequestSerializer($serializer ?: new RequestSerializer()); $this->setRequestSerializer($serializer ?: new RequestSerializer());
$this->setResponseReader($reader ?: new ResponseReader()); $this->setResponseReader($reader ?: new ResponseReader());