Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit126be4d

Browse files
committed
fix compatibility with different Relay versions
1 parentda8bc22 commit126be4d

File tree

7 files changed

+378
-3
lines changed

7 files changed

+378
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ public function testRelayProxy()
8787
$expectedMethods = [];
8888

8989
foreach ((new \ReflectionClass(RelayProxy::class))->getMethods()as$method) {
90-
if ('reset' ===$method->name ||method_exists(LazyProxyTrait::class,$method->name) ||$method->isStatic()) {
90+
if ('reset' ===$method->name ||method_exists(LazyProxyTrait::class,$method->name) ||$method->isInternal()) {
9191
continue;
9292
}
9393

9494
$return =$method->getReturnType()instanceof \ReflectionNamedType &&'void' === (string)$method->getReturnType() ?'' :'return';
95-
$expectedMethods[$method->name] ="\n".ProxyHelper::exportSignature($method,false,$args)."\n".<<<EOPHP
95+
$expectedMethods[$method->name] ="\n".ProxyHelper::exportSignature($method,true,$args)."\n".<<<EOPHP
9696
{
9797
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
9898
}
@@ -101,7 +101,7 @@ public function testRelayProxy()
101101
}
102102

103103
foreach ((new \ReflectionClass(Relay::class))->getMethods()as$method) {
104-
if ('reset' ===$method->name ||method_exists(LazyProxyTrait::class,$method->name) ||$method->isStatic()) {
104+
if ('__destruct' ===$method->name ||'reset' ===$method->name ||$method->isStatic()) {
105105
continue;
106106
}
107107
$return =$method->getReturnType()instanceof \ReflectionNamedType &&'void' === (string)$method->getReturnType() ?'' :'return';
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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+
namespaceSymfony\Component\Cache\Traits\Relay;
13+
14+
var_dump(phpversion('relay'));
15+
16+
if (version_compare(phpversion('relay'),'0.9.0','>=')) {
17+
/**
18+
* @internal
19+
*/
20+
trait FtTrait
21+
{
22+
publicfunctionftAggregate($index,$query,$options =null):\Relay\Relay|array|false
23+
{
24+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAggregate(...\func_get_args());
25+
}
26+
27+
publicfunctionftAliasAdd($index,$alias):\Relay\Relay|bool
28+
{
29+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAliasAdd(...\func_get_args());
30+
}
31+
32+
publicfunctionftAliasDel($alias):\Relay\Relay|bool
33+
{
34+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAliasDel(...\func_get_args());
35+
}
36+
37+
publicfunctionftAliasUpdate($index,$alias):\Relay\Relay|bool
38+
{
39+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAliasUpdate(...\func_get_args());
40+
}
41+
42+
publicfunctionftAlter($index,$schema,$skipinitialscan =false):\Relay\Relay|bool
43+
{
44+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAlter(...\func_get_args());
45+
}
46+
47+
publicfunctionftConfig($operation,$option,$value =null):\Relay\Relay|array|bool
48+
{
49+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftConfig(...\func_get_args());
50+
}
51+
52+
publicfunctionftCreate($index,$schema,$options =null):\Relay\Relay|bool
53+
{
54+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftCreate(...\func_get_args());
55+
}
56+
57+
publicfunctionftCursor($operation,$index,$cursor,$options =null):\Relay\Relay|array|bool
58+
{
59+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftCursor(...\func_get_args());
60+
}
61+
62+
publicfunctionftDictAdd($dict,$term, ...$other_terms):\Relay\Relay|false|int
63+
{
64+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDictAdd(...\func_get_args());
65+
}
66+
67+
publicfunctionftDictDel($dict,$term, ...$other_terms):\Relay\Relay|false|int
68+
{
69+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDictDel(...\func_get_args());
70+
}
71+
72+
publicfunctionftDictDump($dict):\Relay\Relay|array|false
73+
{
74+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDictDump(...\func_get_args());
75+
}
76+
77+
publicfunctionftDropIndex($index,$dd =false):\Relay\Relay|bool
78+
{
79+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDropIndex(...\func_get_args());
80+
}
81+
82+
publicfunctionftExplain($index,$query,$dialect =0):\Relay\Relay|false|string
83+
{
84+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftExplain(...\func_get_args());
85+
}
86+
87+
publicfunctionftExplainCli($index,$query,$dialect =0):\Relay\Relay|array|false
88+
{
89+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftExplainCli(...\func_get_args());
90+
}
91+
92+
publicfunctionftInfo($index):\Relay\Relay|array|false
93+
{
94+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftInfo(...\func_get_args());
95+
}
96+
97+
publicfunctionftProfile($index,$command,$query,$limited =false):\Relay\Relay|array|false
98+
{
99+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftProfile(...\func_get_args());
100+
}
101+
102+
publicfunctionftSearch($index,$query,$options =null):\Relay\Relay|array|false
103+
{
104+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSearch(...\func_get_args());
105+
}
106+
107+
publicfunctionftSpellCheck($index,$query,$options =null):\Relay\Relay|array|false
108+
{
109+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSpellCheck(...\func_get_args());
110+
}
111+
112+
publicfunctionftSynDump($index):\Relay\Relay|array|false
113+
{
114+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSynDump(...\func_get_args());
115+
}
116+
117+
publicfunctionftSynUpdate($index,$synonym,$term_or_terms,$skipinitialscan =false):\Relay\Relay|bool
118+
{
119+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSynUpdate(...\func_get_args());
120+
}
121+
122+
publicfunctionftTagVals($index,$tag):\Relay\Relay|array|false
123+
{
124+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftTagVals(...\func_get_args());
125+
}
126+
}
127+
}else {
128+
/**
129+
* @internal
130+
*/
131+
trait FtTrait
132+
{
133+
}
134+
}
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+
namespaceSymfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'),'0.10.1','>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait GetWithMetaTrait
19+
{
20+
publicfunctiongetWithMeta($key):\Relay\Relay|array|false
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getWithMeta(...\func_get_args());
23+
}
24+
}
25+
}else {
26+
/**
27+
* @internal
28+
*/
29+
trait GetWithMetaTrait
30+
{
31+
}
32+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
namespaceSymfony\Component\Cache\Traits\Relay;
13+
14+
var_dump(phpversion('relay'));
15+
16+
if (version_compare(phpversion('relay'),'0.11.1','>=')) {
17+
/**
18+
* @internal
19+
*/
20+
trait IsTrackedTrait
21+
{
22+
publicfunctionisTracked($key):bool
23+
{
24+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->isTracked(...\func_get_args());
25+
}
26+
}
27+
}else {
28+
/**
29+
* @internal
30+
*/
31+
trait IsTrackedTrait
32+
{
33+
}
34+
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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+
namespaceSymfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'),'0.11.0','>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait Relay11Trait
19+
{
20+
publicfunctioncmsIncrBy($key,$field,$value, ...$fields_and_falues):\Relay\Relay|array|false
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsIncrBy(...\func_get_args());
23+
}
24+
25+
publicfunctioncmsInfo($key):\Relay\Relay|array|false
26+
{
27+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsInfo(...\func_get_args());
28+
}
29+
30+
publicfunctioncmsInitByDim($key,$width,$depth):\Relay\Relay|bool
31+
{
32+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsInitByDim(...\func_get_args());
33+
}
34+
35+
publicfunctioncmsInitByProb($key,$error,$probability):\Relay\Relay|bool
36+
{
37+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsInitByProb(...\func_get_args());
38+
}
39+
40+
publicfunctioncmsMerge($dstkey,$keys,$weights = []):\Relay\Relay|bool
41+
{
42+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsMerge(...\func_get_args());
43+
}
44+
45+
publicfunctioncmsQuery($key, ...$fields):\Relay\Relay|array|false
46+
{
47+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsQuery(...\func_get_args());
48+
}
49+
50+
publicfunctioncommandlog($subcmd, ...$args):\Relay\Relay|array|bool|int
51+
{
52+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->commandlog(...\func_get_args());
53+
}
54+
55+
publicfunctionhexpire($hash,$ttl,$fields,$mode =null):\Relay\Relay|array|false
56+
{
57+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexpire(...\func_get_args());
58+
}
59+
60+
publicfunctionhexpireat($hash,$ttl,$fields,$mode =null):\Relay\Relay|array|false
61+
{
62+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexpireat(...\func_get_args());
63+
}
64+
65+
publicfunctionhexpiretime($hash,$fields):\Relay\Relay|array|false
66+
{
67+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexpiretime(...\func_get_args());
68+
}
69+
70+
publicfunctionhgetdel($key,$fields):\Relay\Relay|array|false
71+
{
72+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetdel(...\func_get_args());
73+
}
74+
75+
publicfunctionhgetex($hash,$fields,$expiry =null):\Relay\Relay|array|false
76+
{
77+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetex(...\func_get_args());
78+
}
79+
80+
publicfunctionhpersist($hash,$fields):\Relay\Relay|array|false
81+
{
82+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpersist(...\func_get_args());
83+
}
84+
85+
publicfunctionhpexpire($hash,$ttl,$fields,$mode =null):\Relay\Relay|array|false
86+
{
87+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpexpire(...\func_get_args());
88+
}
89+
90+
publicfunctionhpexpireat($hash,$ttl,$fields,$mode =null):\Relay\Relay|array|false
91+
{
92+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpexpireat(...\func_get_args());
93+
}
94+
95+
publicfunctionhpexpiretime($hash,$fields):\Relay\Relay|array|false
96+
{
97+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpexpiretime(...\func_get_args());
98+
}
99+
100+
publicfunctionhpttl($hash,$fields):\Relay\Relay|array|false
101+
{
102+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpttl(...\func_get_args());
103+
}
104+
105+
publicfunctionhsetex($key,$fields,$expiry =null):\Relay\Relay|false|int
106+
{
107+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hsetex(...\func_get_args());
108+
}
109+
110+
publicfunctionhttl($hash,$fields):\Relay\Relay|array|false
111+
{
112+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->httl(...\func_get_args());
113+
}
114+
115+
publicfunctionserverName():false|string
116+
{
117+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->serverName(...\func_get_args());
118+
}
119+
120+
publicfunctionserverVersion():false|string
121+
{
122+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->serverVersion(...\func_get_args());
123+
}
124+
}
125+
}else {
126+
/**
127+
* @internal
128+
*/
129+
trait Relay11Trait
130+
{
131+
}
132+
}
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+
namespaceSymfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'),'0.9.0','>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait SwapdbTrait
19+
{
20+
publicfunctionswapdb($index1,$index2):\Relay\Relay|bool
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->swapdb(...\func_get_args());
23+
}
24+
}
25+
}else {
26+
/**
27+
* @internal
28+
*/
29+
trait SwapdbTrait
30+
{
31+
}
32+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp