Skip to content

Commit 32aab6e

Browse files
committed
minor symfony#57745 [Cache] do not use LazyProxyTrait in RelayProxyTrait (xabbuh)
This PR was merged into the 7.2 branch. Discussion ---------- [Cache] do not use LazyProxyTrait in RelayProxyTrait | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT fixes tests after merging symfony#57723 up into the `7.2` branch by taking symfony#57326 into account Commits ------- a0a0867 do not use LazyProxyTrait in RelayProxyTrait
2 parents 9f971f0 + a0a0867 commit 32aab6e

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ public function testRelayProxy()
7272
continue;
7373
}
7474

75-
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
75+
$return = '__construct' === $method->name || $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
7676
$expectedMethods[$method->name] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<<EOPHP
7777
{
78-
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
78+
{$return}\$this->initializeLazyObject()->{$method->name}({$args});
7979
}
8080
8181
EOPHP;

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,122 +24,122 @@ public function copy($src, $dst, $options = null): \Relay\Relay|bool
2424

2525
public function jsonArrAppend($key, $value_or_array, $path = null): \Relay\Relay|array|false
2626
{
27-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrAppend(...\func_get_args());
27+
return $this->initializeLazyObject()->jsonArrAppend(...\func_get_args());
2828
}
2929

3030
public function jsonArrIndex($key, $path, $value, $start = 0, $stop = -1): \Relay\Relay|array|false
3131
{
32-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrIndex(...\func_get_args());
32+
return $this->initializeLazyObject()->jsonArrIndex(...\func_get_args());
3333
}
3434

3535
public function jsonArrInsert($key, $path, $index, $value, ...$other_values): \Relay\Relay|array|false
3636
{
37-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrInsert(...\func_get_args());
37+
return $this->initializeLazyObject()->jsonArrInsert(...\func_get_args());
3838
}
3939

4040
public function jsonArrLen($key, $path = null): \Relay\Relay|array|false
4141
{
42-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrLen(...\func_get_args());
42+
return $this->initializeLazyObject()->jsonArrLen(...\func_get_args());
4343
}
4444

4545
public function jsonArrPop($key, $path = null, $index = -1): \Relay\Relay|array|false
4646
{
47-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrPop(...\func_get_args());
47+
return $this->initializeLazyObject()->jsonArrPop(...\func_get_args());
4848
}
4949

5050
public function jsonArrTrim($key, $path, $start, $stop): \Relay\Relay|array|false
5151
{
52-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrTrim(...\func_get_args());
52+
return $this->initializeLazyObject()->jsonArrTrim(...\func_get_args());
5353
}
5454

5555
public function jsonClear($key, $path = null): \Relay\Relay|false|int
5656
{
57-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonClear(...\func_get_args());
57+
return $this->initializeLazyObject()->jsonClear(...\func_get_args());
5858
}
5959

6060
public function jsonDebug($command, $key, $path = null): \Relay\Relay|false|int
6161
{
62-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonDebug(...\func_get_args());
62+
return $this->initializeLazyObject()->jsonDebug(...\func_get_args());
6363
}
6464

6565
public function jsonDel($key, $path = null): \Relay\Relay|false|int
6666
{
67-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonDel(...\func_get_args());
67+
return $this->initializeLazyObject()->jsonDel(...\func_get_args());
6868
}
6969

7070
public function jsonForget($key, $path = null): \Relay\Relay|false|int
7171
{
72-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonForget(...\func_get_args());
72+
return $this->initializeLazyObject()->jsonForget(...\func_get_args());
7373
}
7474

7575
public function jsonGet($key, $options = [], ...$paths): mixed
7676
{
77-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonGet(...\func_get_args());
77+
return $this->initializeLazyObject()->jsonGet(...\func_get_args());
7878
}
7979

8080
public function jsonMerge($key, $path, $value): \Relay\Relay|bool
8181
{
82-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMerge(...\func_get_args());
82+
return $this->initializeLazyObject()->jsonMerge(...\func_get_args());
8383
}
8484

8585
public function jsonMget($key_or_array, $path): \Relay\Relay|array|false
8686
{
87-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMget(...\func_get_args());
87+
return $this->initializeLazyObject()->jsonMget(...\func_get_args());
8888
}
8989

9090
public function jsonMset($key, $path, $value, ...$other_triples): \Relay\Relay|bool
9191
{
92-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMset(...\func_get_args());
92+
return $this->initializeLazyObject()->jsonMset(...\func_get_args());
9393
}
9494

9595
public function jsonNumIncrBy($key, $path, $value): \Relay\Relay|array|false
9696
{
97-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonNumIncrBy(...\func_get_args());
97+
return $this->initializeLazyObject()->jsonNumIncrBy(...\func_get_args());
9898
}
9999

100100
public function jsonNumMultBy($key, $path, $value): \Relay\Relay|array|false
101101
{
102-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonNumMultBy(...\func_get_args());
102+
return $this->initializeLazyObject()->jsonNumMultBy(...\func_get_args());
103103
}
104104

105105
public function jsonObjKeys($key, $path = null): \Relay\Relay|array|false
106106
{
107-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonObjKeys(...\func_get_args());
107+
return $this->initializeLazyObject()->jsonObjKeys(...\func_get_args());
108108
}
109109

110110
public function jsonObjLen($key, $path = null): \Relay\Relay|array|false
111111
{
112-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonObjLen(...\func_get_args());
112+
return $this->initializeLazyObject()->jsonObjLen(...\func_get_args());
113113
}
114114

115115
public function jsonResp($key, $path = null): \Relay\Relay|array|false|int|string
116116
{
117-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonResp(...\func_get_args());
117+
return $this->initializeLazyObject()->jsonResp(...\func_get_args());
118118
}
119119

120120
public function jsonSet($key, $path, $value, $condition = null): \Relay\Relay|bool
121121
{
122-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonSet(...\func_get_args());
122+
return $this->initializeLazyObject()->jsonSet(...\func_get_args());
123123
}
124124

125125
public function jsonStrAppend($key, $value, $path = null): \Relay\Relay|array|false
126126
{
127-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonStrAppend(...\func_get_args());
127+
return $this->initializeLazyObject()->jsonStrAppend(...\func_get_args());
128128
}
129129

130130
public function jsonStrLen($key, $path = null): \Relay\Relay|array|false
131131
{
132-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonStrLen(...\func_get_args());
132+
return $this->initializeLazyObject()->jsonStrLen(...\func_get_args());
133133
}
134134

135135
public function jsonToggle($key, $path): \Relay\Relay|array|false
136136
{
137-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonToggle(...\func_get_args());
137+
return $this->initializeLazyObject()->jsonToggle(...\func_get_args());
138138
}
139139

140140
public function jsonType($key, $path = null): \Relay\Relay|array|false
141141
{
142-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonType(...\func_get_args());
142+
return $this->initializeLazyObject()->jsonType(...\func_get_args());
143143
}
144144
}
145145
} else {
@@ -150,7 +150,7 @@ trait RelayProxyTrait
150150
{
151151
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
152152
{
153-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
153+
return $this->initializeLazyObject()->copy(...\func_get_args());
154154
}
155155
}
156156
}

0 commit comments

Comments
 (0)