File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -337,6 +337,10 @@ public function getProxyDir(): ?string
337337 */
338338 public function getAutoGenerateProxyClasses (): int
339339 {
340+ if ($ this ->nativeLazyObject ) {
341+ return self ::AUTOGENERATE_NEVER ;
342+ }
343+
340344 return $ this ->attributes ['autoGenerateProxyClasses ' ] ?? self ::AUTOGENERATE_FILE_NOT_EXISTS ;
341345 }
342346
@@ -708,7 +712,7 @@ public function setUseLazyGhostObject(bool $flag): void
708712
709713 public function isLazyGhostObjectEnabled (): bool
710714 {
711- return $ this ->lazyGhostObject ;
715+ return $ this ->lazyGhostObject && ! $ this -> nativeLazyObject ;
712716 }
713717
714718 public function setUseNativeLazyObject (bool $ nativeLazyObject ): void
@@ -718,7 +722,6 @@ public function setUseNativeLazyObject(bool $nativeLazyObject): void
718722 }
719723
720724 $ this ->nativeLazyObject = $ nativeLazyObject ;
721- $ this ->lazyGhostObject = ! $ nativeLazyObject || $ this ->lazyGhostObject ;
722725 }
723726
724727 public function isNativeLazyObjectEnabled (): bool
Original file line number Diff line number Diff line change @@ -31,6 +31,19 @@ public function testUseNativeLazyObjectBeforePHP84(): void
3131 $ c ->setUseNativeLazyObject (true );
3232 }
3333
34+ public function testUseNativeLazyObjectPriorityOverLazyGhost (): void
35+ {
36+ $ c = new Configuration ();
37+
38+ $ c ->setUseLazyGhostObject (true );
39+ $ c ->setUseNativeLazyObject (true );
40+
41+ self ::assertTrue ($ c ->isNativeLazyObjectEnabled ());
42+ self ::assertFalse ($ c ->isLazyGhostObjectEnabled ());
43+
44+ self ::assertSame (Configuration::AUTOGENERATE_NEVER , $ c ->getAutoGenerateProxyClasses ());
45+ }
46+
3447 public function testUseLazyGhostObject (): void
3548 {
3649 $ c = new Configuration ();
@@ -42,7 +55,7 @@ public function testUseLazyGhostObject(): void
4255 self ::assertFalse ($ c ->isLazyGhostObjectEnabled ());
4356 }
4457
45- public function testNativeLazyObjectDeprecatedByDefault (): void
58+ public function testNativeLazyObjectDisabledByDefault (): void
4659 {
4760 $ c = new Configuration ();
4861
You can’t perform that action at this time.
0 commit comments