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 5ea5ea8

Browse filesBrowse files
[VarExporter] Fix lazy-proxying readonly classes on PHP 8.3
1 parent 88399c7 commit 5ea5ea8
Copy full SHA for 5ea5ea8

20 files changed

+1067
-1047
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
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RedisProxiesTest extends TestCase
2727
public function testRedis5Proxy($class)
2828
{
2929
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}5Proxy.php");
30-
$proxy = substr($proxy, 0, 8 + strpos($proxy, "\n ];"));
30+
$proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
3131
$methods = [];
3232

3333
foreach ((new \ReflectionClass($class))->getMethods() as $method) {
@@ -42,7 +42,7 @@ public function testRedis5Proxy($class)
4242
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
4343
$methods[] = "\n ".ProxyHelper::exportSignature($method, false)."\n".<<<EOPHP
4444
{
45-
{$return}\$this->lazyObjectReal->{$method->name}({$args});
45+
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
4646
}
4747
4848
EOPHP;
@@ -69,7 +69,7 @@ public function testRedis6Proxy($class, $stub)
6969
eval(substr($stub, 5));
7070

7171
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}6Proxy.php");
72-
$proxy = substr($proxy, 0, 8 + strpos($proxy, "\n ];"));
72+
$proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
7373
$methods = [];
7474

7575
foreach ((new \ReflectionClass($class.'StubInterface'))->getMethods() as $method) {
@@ -84,7 +84,7 @@ public function testRedis6Proxy($class, $stub)
8484
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
8585
$methods[] = "\n ".ProxyHelper::exportSignature($method, false)."\n".<<<EOPHP
8686
{
87-
{$return}\$this->lazyObjectReal->{$method->name}({$args});
87+
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
8888
}
8989
9090
EOPHP;

0 commit comments

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