Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6ee411d

Browse filesBrowse files
committed
make RelayProxyTrait compatible with relay extension 0.9.0
1 parent b41de94 commit 6ee411d
Copy full SHA for 6ee411d

10 files changed

+336
-76
lines changed

‎src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ public function testRedisProxy($class)
8080
*/
8181
public function testRelayProxy()
8282
{
83-
var_dump(phpversion('relay'));
84-
var_dump(phpversion('redis'));
8583
$proxy = file_get_contents(\dirname(__DIR__, 2).'/Traits/RelayProxy.php');
8684
$proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
8785
$expectedProxy = $proxy;
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.8.1', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait CopyTrait
19+
{
20+
public function copy($src, $dst, $options = null): \Relay\Relay|bool
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait CopyTrait
30+
{
31+
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
32+
{
33+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
34+
}
35+
}
36+
}
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait GeosearchTrait
19+
{
20+
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array|false
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait GeosearchTrait
30+
{
31+
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array
32+
{
33+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args());
34+
}
35+
}
36+
}
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait GetrangeTrait
19+
{
20+
public function getrange($key, $start, $end): mixed
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait GetrangeTrait
30+
{
31+
public function getrange($key, $start, $end): \Relay\Relay|false|string
32+
{
33+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args());
34+
}
35+
}
36+
}
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait HsetTrait
19+
{
20+
public function hset($key, ...$keys_and_vals): \Relay\Relay|false|int
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait HsetTrait
30+
{
31+
public function hset($key, $mem, $val, ...$kvals): \Relay\Relay|false|int
32+
{
33+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args());
34+
}
35+
}
36+
}
+46Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait MoveTrait
19+
{
20+
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): mixed
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args());
23+
}
24+
25+
public function lmove($srckey, $dstkey, $srcpos, $dstpos): mixed
26+
{
27+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args());
28+
}
29+
}
30+
} else {
31+
/**
32+
* @internal
33+
*/
34+
trait MoveTrait
35+
{
36+
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|null|string
37+
{
38+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args());
39+
}
40+
41+
public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|null|string
42+
{
43+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args());
44+
}
45+
}
46+
}
+96Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait NullableReturnTrait
19+
{
20+
public function dump($key): \Relay\Relay|false|string|null
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
23+
}
24+
25+
public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float|null
26+
{
27+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args());
28+
}
29+
30+
public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string|null
31+
{
32+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args());
33+
}
34+
35+
public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string|null
36+
{
37+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args());
38+
}
39+
40+
public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int|null
41+
{
42+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args());
43+
}
44+
45+
public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int|null
46+
{
47+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args());
48+
}
49+
50+
public function zscore($key, $member): \Relay\Relay|false|float|null
51+
{
52+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args());
53+
}
54+
}
55+
} else {
56+
/**
57+
* @internal
58+
*/
59+
trait NullableReturnTrait
60+
{
61+
public function dump($key): \Relay\Relay|false|string
62+
{
63+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
64+
}
65+
66+
public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float
67+
{
68+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args());
69+
}
70+
71+
public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string
72+
{
73+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args());
74+
}
75+
76+
public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string
77+
{
78+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args());
79+
}
80+
81+
public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int
82+
{
83+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args());
84+
}
85+
86+
public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int
87+
{
88+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args());
89+
}
90+
91+
public function zscore($key, $member): \Relay\Relay|false|float
92+
{
93+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args());
94+
}
95+
}
96+
}
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait PfcountTrait
19+
{
20+
public function pfcount($key_or_keys): \Relay\Relay|false|int
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait PfcountTrait
30+
{
31+
public function pfcount($key): \Relay\Relay|false|int
32+
{
33+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args());
34+
}
35+
}
36+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.