@@ -27,7 +27,7 @@ class RedisProxiesTest extends TestCase
27
27
public function testRedis5Proxy ($ class )
28
28
{
29
29
$ 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 , ' []; ' ));
31
31
$ methods = [];
32
32
33
33
foreach ((new \ReflectionClass ($ class ))->getMethods () as $ method ) {
@@ -42,7 +42,7 @@ public function testRedis5Proxy($class)
42
42
$ return = $ method ->getReturnType () instanceof \ReflectionNamedType && 'void ' === (string ) $ method ->getReturnType () ? '' : 'return ' ;
43
43
$ methods [] = "\n " .ProxyHelper::exportSignature ($ method , false )."\n" .<<<EOPHP
44
44
{
45
- {$ return }\$this->lazyObjectReal -> {$ method ->name }( {$ args });
45
+ {$ return }( \$this->lazyObjectState->realInstance ??= ( \$ this->lazyObjectState->initializer)()) -> {$ method ->name }( {$ args });
46
46
}
47
47
48
48
EOPHP ;
@@ -69,7 +69,7 @@ public function testRedis6Proxy($class, $stub)
69
69
eval (substr ($ stub , 5 ));
70
70
71
71
$ 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 , ' []; ' ));
73
73
$ methods = [];
74
74
75
75
foreach ((new \ReflectionClass ($ class .'StubInterface ' ))->getMethods () as $ method ) {
@@ -84,7 +84,7 @@ public function testRedis6Proxy($class, $stub)
84
84
$ return = $ method ->getReturnType () instanceof \ReflectionNamedType && 'void ' === (string ) $ method ->getReturnType () ? '' : 'return ' ;
85
85
$ methods [] = "\n " .ProxyHelper::exportSignature ($ method , false )."\n" .<<<EOPHP
86
86
{
87
- {$ return }\$this->lazyObjectReal -> {$ method ->name }( {$ args });
87
+ {$ return }( \$this->lazyObjectState->realInstance ??= ( \$ this->lazyObjectState->initializer)()) -> {$ method ->name }( {$ args });
88
88
}
89
89
90
90
EOPHP ;
0 commit comments