File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 55use Attribute ;
66
77#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS )]
8- class Proxy
8+ class Lazy
99{
1010}
Original file line number Diff line number Diff line change 66use Closure ;
77use Exception ;
88use Illuminate \Container \Attributes \Bind ;
9- use Illuminate \Container \Attributes \Proxy ;
9+ use Illuminate \Container \Attributes \Lazy ;
1010use Illuminate \Container \Attributes \Scoped ;
1111use Illuminate \Container \Attributes \Singleton ;
1212use Illuminate \Contracts \Container \BindingResolutionException ;
@@ -1165,7 +1165,7 @@ public function build($concrete, $withoutLazyFor = [])
11651165 return $ instance ;
11661166 }
11671167
1168- if (! in_array ($ concrete , $ withoutLazyFor ) && ! empty ($ reflector ->getAttributes (Proxy ::class))) {
1168+ if (! in_array ($ concrete , $ withoutLazyFor ) && ! empty ($ reflector ->getAttributes (Lazy ::class))) {
11691169 return proxy ($ concrete , fn () => $ this ->build ($ concrete , [$ concrete ]));
11701170 }
11711171
Original file line number Diff line number Diff line change 44
55use Attribute ;
66use Illuminate \Container \Attributes \Bind ;
7- use Illuminate \Container \Attributes \Proxy ;
7+ use Illuminate \Container \Attributes \Lazy ;
88use Illuminate \Container \Attributes \Scoped ;
99use Illuminate \Container \Attributes \Singleton ;
1010use Illuminate \Container \Container ;
@@ -232,7 +232,7 @@ public function testLazyObjects()
232232 $ container ->bind (IContainerContractStub::class, ContainerImplementationStub::class);
233233 $ class = $ container ->make (ProxyDependenciesClass::class);
234234 $ this ->assertTrue ((new ReflectionClass ($ class ))->isUninitializedLazyObject ($ class ));
235- $ class ->stubby ;
235+ $ this -> assertTrue ( $ class ->stubbyIsSet ()) ;
236236 $ this ->assertFalse ((new ReflectionClass ($ class ))->isUninitializedLazyObject ($ class ));
237237 }
238238
@@ -1230,12 +1230,16 @@ public function __construct()
12301230 }
12311231}
12321232
1233- #[Proxy ]
1233+ #[Lazy ]
12341234class ProxyDependenciesClass
12351235{
12361236 public function __construct (
12371237 public IContainerContractStub $ stubby
12381238 ) {
1239- //dd('i have been constructed!');
1239+ }
1240+
1241+ public function stubbyIsSet (): bool
1242+ {
1243+ return isset ($ this ->stubby );
12401244 }
12411245}
You can’t perform that action at this time.
0 commit comments