On Wed, May 14, 2025, at 4:00 PM, Tim Düsterhus wrote: > The internal implementation is roughly equivalent to: > > $cloned = clone $object; > foreach ($withProperties as $key => $value) { > $cloned->{$key} = $value; > } > return $cloned; > > Just with the exception that writing readonly properties is allowed on > the clone (unless already touched by `__clone()`).
Subtle point here. If the __clone() method touches a readonly property, does that make the property inaccessible to the new clone-with? Or is it a separate "unlock scope"? I would expect the latter. A single unlock block would be confusing to me. --Larry Garfield