Re: [RFC] Lazy Objects

From: Date: Fri, 14 Jun 2024 20:25:50 +0000
Subject: Re: [RFC] Lazy Objects
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-123608@lists.php.net to get a copy of this message
On Fri, Jun 14, 2024, at 8:15 PM, Larry Garfield wrote: And of course I got the code sample wrong. It should be: > class Service { > public function __construct(private ServiceA $a, private ServiceB $b) {} > } > > $c = some_container(); > > $init = fn() => $this->__construct($c->get(ServiceA::class), > $c->get(ServiceB::class)); > > $service = new ReflectionLazyObjectFactory(Service::class)->newGhostInstance(init); Sorry about that. --Larry Garfield

« previous php.internals (#123608) next »