Skip to content

Commit a6a5faa

Browse files
bug #62087 [Cache] fix compatibility with Relay 0.12.1 (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [Cache] fix compatibility with Relay 0.12.1 | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT see https://github.com/cachewerk/relay/releases/tag/v0.12.1 Commits ------- 21117a6 fix compatibility with Relay 0.12.1
2 parents f894d2a + 21117a6 commit a6a5faa

File tree

4 files changed

+87
-10
lines changed

4 files changed

+87
-10
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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.12.1', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait Relay121Trait
19+
{
20+
public function hgetWithMeta($hash, $member): \Relay\Relay|array|false
21+
{
22+
return $this->initializeLazyObject()->getWithMeta(...\func_get_args());
23+
}
24+
25+
public function select($db): \Relay\Relay|bool|string
26+
{
27+
return $this->initializeLazyObject()->select(...\func_get_args());
28+
}
29+
30+
public function watch($key, ...$other_keys): \Relay\Relay|bool|string
31+
{
32+
return $this->initializeLazyObject()->watch(...\func_get_args());
33+
}
34+
}
35+
} else {
36+
/**
37+
* @internal
38+
*/
39+
trait Relay121Trait
40+
{
41+
public function select($db): \Relay\Relay|bool
42+
{
43+
return $this->initializeLazyObject()->select(...\func_get_args());
44+
}
45+
46+
public function watch($key, ...$other_keys): \Relay\Relay|bool
47+
{
48+
return $this->initializeLazyObject()->watch(...\func_get_args());
49+
}
50+
}
51+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.12.1', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait RelayCluster121Trait
19+
{
20+
public function hgetWithMeta($hash, $member): \Relay\Cluster|array|false
21+
{
22+
return $this->initializeLazyObject()->getWithMeta(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait RelayCluster121Trait
30+
{
31+
}
32+
}

src/Symfony/Component/Cache/Traits/RelayClusterProxy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Relay\Cluster;
1515
use Relay\Relay;
1616
use Symfony\Component\Cache\Traits\Relay\RelayCluster11Trait;
17+
use Symfony\Component\Cache\Traits\Relay\RelayCluster121Trait;
1718
use Symfony\Component\Cache\Traits\Relay\RelayCluster12Trait;
1819
use Symfony\Component\VarExporter\LazyObjectInterface;
1920
use Symfony\Contracts\Service\ResetInterface;
@@ -32,6 +33,7 @@ class RelayClusterProxy extends Cluster implements ResetInterface, LazyObjectInt
3233
resetLazyObject as reset;
3334
}
3435
use RelayCluster11Trait;
36+
use RelayCluster121Trait;
3537
use RelayCluster12Trait;
3638

3739
public function __construct(

src/Symfony/Component/Cache/Traits/RelayProxy.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\Cache\Traits\Relay\NullableReturnTrait;
2424
use Symfony\Component\Cache\Traits\Relay\PfcountTrait;
2525
use Symfony\Component\Cache\Traits\Relay\Relay11Trait;
26+
use Symfony\Component\Cache\Traits\Relay\Relay121Trait;
2627
use Symfony\Component\Cache\Traits\Relay\Relay12Trait;
2728
use Symfony\Component\Cache\Traits\Relay\SwapdbTrait;
2829
use Symfony\Component\VarExporter\LazyObjectInterface;
@@ -55,6 +56,7 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter
5556
use RelayProxyTrait;
5657
use Relay11Trait;
5758
use Relay12Trait;
59+
use Relay121Trait;
5860
use SwapdbTrait;
5961

6062
public function __construct($host = null, $port = 6379, $connect_timeout = 0.0, $command_timeout = 0.0, #[\SensitiveParameter] $context = [], $database = 0)
@@ -247,11 +249,6 @@ public function rawCommand($cmd, ...$args): mixed
247249
return $this->initializeLazyObject()->rawCommand(...\func_get_args());
248250
}
249251

250-
public function select($db): \Relay\Relay|bool
251-
{
252-
return $this->initializeLazyObject()->select(...\func_get_args());
253-
}
254-
255252
public function auth(#[\SensitiveParameter] $auth): bool
256253
{
257254
return $this->initializeLazyObject()->auth(...\func_get_args());
@@ -937,11 +934,6 @@ public function wait($replicas, $timeout): \Relay\Relay|false|int
937934
return $this->initializeLazyObject()->wait(...\func_get_args());
938935
}
939936

940-
public function watch($key, ...$other_keys): \Relay\Relay|bool
941-
{
942-
return $this->initializeLazyObject()->watch(...\func_get_args());
943-
}
944-
945937
public function unwatch(): \Relay\Relay|bool
946938
{
947939
return $this->initializeLazyObject()->unwatch(...\func_get_args());

0 commit comments

Comments
 (0)