File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-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,20 @@ public function testUseNativeLazyObjectBeforePHP84(): void
3131 $ c ->setUseNativeLazyObject (true );
3232 }
3333
34+ #[RequiresPhp('>= 8.4 ' )]
35+ public function testUseNativeLazyObjectPriorityOverLazyGhost (): void
36+ {
37+ $ c = new Configuration ();
38+
39+ $ c ->setUseLazyGhostObject (true );
40+ $ c ->setUseNativeLazyObject (true );
41+
42+ self ::assertTrue ($ c ->isNativeLazyObjectEnabled ());
43+ self ::assertFalse ($ c ->isLazyGhostObjectEnabled ());
44+
45+ self ::assertSame (Configuration::AUTOGENERATE_NEVER , $ c ->getAutoGenerateProxyClasses ());
46+ }
47+
3448 public function testUseLazyGhostObject (): void
3549 {
3650 $ c = new Configuration ();
@@ -42,7 +56,7 @@ public function testUseLazyGhostObject(): void
4256 self ::assertFalse ($ c ->isLazyGhostObjectEnabled ());
4357 }
4458
45- public function testNativeLazyObjectDeprecatedByDefault (): void
59+ public function testNativeLazyObjectDisabledByDefault (): void
4660 {
4761 $ c = new Configuration ();
4862
You can’t perform that action at this time.
0 commit comments