@@ -49,14 +49,14 @@ public function xadd(string $key, array $dictionary): string|Pipeline|PhpRedis
49
49
*/
50
50
public function xrange (string $ key , string $ start , string $ end , int $ count = null ): array
51
51
{
52
- return collect ($ this ->handle ([
52
+ return collect ($ this ->handle ([ // @phpstan-ignore return.type argument.templateType argument.templateType
53
53
'XRANGE ' ,
54
54
$ this ->config ->get ('database.redis.options.prefix ' ).$ key ,
55
55
$ start ,
56
56
$ end ,
57
57
...$ count !== null ? ['COUNT ' , "$ count " ] : [],
58
58
]))->mapWithKeys (fn ($ value , $ key ) => [
59
- $ value [0 ] => collect ($ value [1 ])
59
+ $ value [0 ] => collect ($ value [1 ]) // @phpstan-ignore argument.templateType argument.templateType
60
60
->chunk (2 )
61
61
->map ->values ()
62
62
->mapWithKeys (fn ($ value , $ key ) => [$ value [0 ] => $ value [1 ]])
@@ -74,7 +74,7 @@ public function xtrim(string $key, string $strategy, string $strategyModifier, s
74
74
$ this ->config ->get ('database.redis.options.prefix ' ).$ key ,
75
75
$ strategy ,
76
76
$ strategyModifier ,
77
- $ threshold ,
77
+ ( string ) $ threshold ,
78
78
]);
79
79
}
80
80
@@ -106,13 +106,15 @@ public function pipeline(callable $closure): array
106
106
107
107
/**
108
108
* Run the given command.
109
+ *
110
+ * @param list<string> $args
109
111
*/
110
- protected function handle ($ args ): mixed
112
+ protected function handle (array $ args ): mixed
111
113
{
112
114
try {
113
115
return tap ($ this ->run ($ args ), function ($ result ) {
114
116
if ($ result === false && $ this ->client () instanceof PhpRedis) {
115
- throw new RedisClientException ($ this ->client ()->getLastError ());
117
+ throw new RedisClientException ($ this ->client ()->getLastError () ?? ' An unknown error occurred. ' );
116
118
}
117
119
});
118
120
} catch (PredisServerException $ e ) {
@@ -122,13 +124,15 @@ protected function handle($args): mixed
122
124
123
125
/**
124
126
* Run the given command.
127
+ *
128
+ * @param list<string> $args
125
129
*/
126
- protected function run ($ args ): mixed
130
+ protected function run (array $ args ): mixed
127
131
{
128
132
return match (true ) {
129
133
$ this ->client () instanceof PhpRedis => $ this ->client ()->rawCommand (...$ args ),
130
134
$ this ->client () instanceof Predis,
131
- $ this ->client () instanceof Pipeline => $ this ->client ()->executeCommand (new RawCommand ( $ args )),
135
+ $ this ->client () instanceof Pipeline => $ this ->client ()->executeCommand (RawCommand:: create (... $ args )),
132
136
};
133
137
}
134
138
0 commit comments