On Tue, Jun 18, 2024, at 5:45 PM, Arnaud Le Blanc wrote: > Hi Larry, > > Following your feedback we propose to amend the API as follows: > > ``` > class ReflectionClass > { > public function newLazyProxy(callable $factory, int $options): object {} > > public function newLazyGhost(callable $initializer, int $options): object > {} > > public function resetAsLazyProxy(object $object, callable > $factory, int $options): void {} > > public function resetAsLazyGhost(object $object, callable > $initializer, int $options): void {} > > public function initialize(object $object): object {} > > public function isInitialized(object $object): bool {} > > // existing methods > } > > class ReflectionProperty > { > public function setRawValueWithoutInitialization(object $object, > mixed $value): void {} > > public function skipInitialization(object $object): void {} > > // existing methods > } > ``` > > Comments / rationale: > - Adding methods on ReflectionClass instead of ReflectionObject is > better from a performance point of view, as mentioned earlier > - Keeping the word "Lazy" in method names is clearer, especially for > "newLazyProxy" as a the "Proxy" pattern has many uses-cases that are > not related to laziness. However we removed the word "Instance" to > make the names shorter. > - We have renamed "make" methods to "reset", following your feedback > about the word "make". It should better convey the behavior of these > methods, and clarify that it's modifying the object in-place as well > as resetting its state > - setRawValueWithoutInitialization() has the same behavior as > setRawValue() (from the hooks RFC), except it doesn't trigger > initialization > - Renamed $initializer to $factory for proxy methods > > WDYT? > > Best Regards, > Arnaud
Oh, that looks *so* much more self-explanatory and readable. I love it. Thanks! (Looks like the RFC text hasn't been updated yet.) --Larry Garfield