Skip to content

Commit cc6af1b

Browse files
committed
sync the Redis6Proxy class with latest upstream changes
see phpredis/phpredis#2162, phpredis/phpredis#2163, and phpredis/phpredis#2166
1 parent 3917396 commit cc6af1b

3 files changed

Lines changed: 55 additions & 5 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RedisProxiesTest extends TestCase
2626
*/
2727
public function testRedis5Proxy($class)
2828
{
29-
$proxy = file_get_contents(\dirname(__DIR__)."/Traits/{$class}5Proxy.php");
29+
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}5Proxy.php");
3030
$proxy = substr($proxy, 0, 8 + strpos($proxy, "\n ];"));
3131
$methods = [];
3232

@@ -46,7 +46,7 @@ public function testRedis5Proxy($class)
4646
uksort($methods, 'strnatcmp');
4747
$proxy .= implode('', $methods)."}\n";
4848

49-
$this->assertStringEqualsFile(\dirname(__DIR__)."/Traits/{$class}5Proxy.php", $proxy);
49+
$this->assertStringEqualsFile(\dirname(__DIR__, 2)."/Traits/{$class}5Proxy.php", $proxy);
5050
}
5151

5252
/**
@@ -60,7 +60,7 @@ public function testRedis6Proxy($class, $stub)
6060
$stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1);
6161
eval(substr($stub, 5));
6262

63-
$proxy = file_get_contents(\dirname(__DIR__)."/Traits/{$class}6Proxy.php");
63+
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}6Proxy.php");
6464
$proxy = substr($proxy, 0, 8 + strpos($proxy, "\n ];"));
6565
$methods = [];
6666

@@ -80,6 +80,6 @@ public function testRedis6Proxy($class, $stub)
8080
uksort($methods, 'strnatcmp');
8181
$proxy .= implode('', $methods)."}\n";
8282

83-
$this->assertStringEqualsFile(\dirname(__DIR__)."/Traits/{$class}6Proxy.php", $proxy);
83+
$this->assertStringEqualsFile(\dirname(__DIR__, 2)."/Traits/{$class}6Proxy.php", $proxy);
8484
}
8585
}

Traits/Redis6Proxy.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function command($opt, $arg): mixed
162162
return $this->lazyObjectReal->command(...\func_get_args());
163163
}
164164

165-
public function config($operation, $key, $value = null): mixed
165+
public function config($operation, $key = null, $value = null): mixed
166166
{
167167
return $this->lazyObjectReal->config(...\func_get_args());
168168
}
@@ -257,6 +257,16 @@ public function failover($to = null, $abort = false, $timeout = 0): bool
257257
return $this->lazyObjectReal->failover(...\func_get_args());
258258
}
259259

260+
public function expiretime($key): \Redis|false|int
261+
{
262+
return $this->lazyObjectReal->expiretime(...\func_get_args());
263+
}
264+
265+
public function pexpiretime($key): \Redis|false|int
266+
{
267+
return $this->lazyObjectReal->pexpiretime(...\func_get_args());
268+
}
269+
260270
public function flushAll($sync = null): bool
261271
{
262272
return $this->lazyObjectReal->flushAll(...\func_get_args());
@@ -382,6 +392,11 @@ public function getRange($key, $start, $end)
382392
return $this->lazyObjectReal->getRange(...\func_get_args());
383393
}
384394

395+
public function lcs($key1, $key2, $options = null): \Redis|array|false|int|string
396+
{
397+
return $this->lazyObjectReal->lcs(...\func_get_args());
398+
}
399+
385400
public function getReadTimeout(): int
386401
{
387402
return $this->lazyObjectReal->getReadTimeout(...\func_get_args());
@@ -767,6 +782,11 @@ public function sInter($key, ...$other_keys): array
767782
return $this->lazyObjectReal->sInter(...\func_get_args());
768783
}
769784

785+
public function sintercard($keys, $limit = -1): \Redis|false|int
786+
{
787+
return $this->lazyObjectReal->sintercard(...\func_get_args());
788+
}
789+
770790
public function sInterStore($dst, $key, ...$other_keys): int
771791
{
772792
return $this->lazyObjectReal->sInterStore(...\func_get_args());
@@ -1162,6 +1182,11 @@ public function zinter($keys, $weights = null, $options = null): array
11621182
return $this->lazyObjectReal->zinter(...\func_get_args());
11631183
}
11641184

1185+
public function zintercard($keys, $limit = -1): \Redis|false|int
1186+
{
1187+
return $this->lazyObjectReal->zintercard(...\func_get_args());
1188+
}
1189+
11651190
public function zinterstore($dst, $keys, $weights = null, $aggregate = null): int
11661191
{
11671192
return $this->lazyObjectReal->zinterstore(...\func_get_args());

Traits/RedisCluster6Proxy.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,16 @@ public function expireat($key, $timestamp): bool
247247
return $this->lazyObjectReal->expireat(...\func_get_args());
248248
}
249249

250+
public function expiretime($key): \Redis|false|int
251+
{
252+
return $this->lazyObjectReal->expiretime(...\func_get_args());
253+
}
254+
255+
public function pexpiretime($key): \Redis|false|int
256+
{
257+
return $this->lazyObjectReal->pexpiretime(...\func_get_args());
258+
}
259+
250260
public function flushall($node, $async = false): bool
251261
{
252262
return $this->lazyObjectReal->flushall(...\func_get_args());
@@ -327,6 +337,11 @@ public function getrange($key, $start, $end): string
327337
return $this->lazyObjectReal->getrange(...\func_get_args());
328338
}
329339

340+
public function lcs($key1, $key2, $options = null): \Redis|array|false|int|string
341+
{
342+
return $this->lazyObjectReal->lcs(...\func_get_args());
343+
}
344+
330345
public function getset($key, $value): string
331346
{
332347
return $this->lazyObjectReal->getset(...\func_get_args());
@@ -707,6 +722,11 @@ public function sinter($key, ...$other_keys): array
707722
return $this->lazyObjectReal->sinter(...\func_get_args());
708723
}
709724

725+
public function sintercard($keys, $limit = -1): \Redis|false|int
726+
{
727+
return $this->lazyObjectReal->sintercard(...\func_get_args());
728+
}
729+
710730
public function sinterstore($dst, $key, ...$other_keys): bool
711731
{
712732
return $this->lazyObjectReal->sinterstore(...\func_get_args());
@@ -902,6 +922,11 @@ public function zinterstore($key, $keys, $weights = null, $aggregate = null): in
902922
return $this->lazyObjectReal->zinterstore(...\func_get_args());
903923
}
904924

925+
public function zintercard($keys, $limit = -1): \Redis|false|int
926+
{
927+
return $this->lazyObjectReal->zintercard(...\func_get_args());
928+
}
929+
905930
public function zlexcount($key, $min, $max): int
906931
{
907932
return $this->lazyObjectReal->zlexcount(...\func_get_args());

0 commit comments

Comments
 (0)