Hey Larry,

Couple points from a first read and from trying to run the examples.

a) From the "ProductFromDB" i get:

> Fatal error: Uncaught TypeError: LazyProduct::$category::get(): Return
value must be of type Category, none returned in ...

I assume you're missing a return statement here? Or is there something I'm
missing?

b) Minor wording gripe in the proposal section

> On the other hand, there is no shortage of dumb things that people can do
with PHP already.

While I don't disagree that PHP gives people a lot of freedom in how they
want to write their code, I find it a bit crude for an RFC to phrase it
like that. And the __get comparison is strong enough to stand on its own.

c)

> That is, we feel, an entirely reasonable use of hooks, and would allow
for lazy-load behavior per-property on readonly classes.

I might be misunderstanding the sentence here, but on-demand/Lazy
initialization of properties on readonly classes is already possible in
classic getter/setter classes.

Do you mean you want to have parity to this behavior when using hooks? I'm
all for it, I just feel the sentence says this enables something that
wasn't possible before but if you mean this in scope property access it
makes sense to me.

d) PositivePoint

Example doesn't compile against 8.4, master, or
against NickSdot:readonly-hooks

Can you make this a script that runs and shows expected output so that
readers don't have to assume this is supposed to do or run it?

e) Backward Incompatible Changes

Section is not filled in yet

f) Date: 2024-07-10

Is this correct? I know you created the page back then, but was there a
discussion already that I wasn't able to find?

Kind Regards,
Volker

On Sun, Jun 8, 2025 at 6:18 AM Larry Garfield <la...@garfieldtech.com>
wrote:

> As Nick has graciously provided an implementation, we would like to open
> discussion on this very small RFC to allow `readonly` on backed properties
> even if they have a hook defined.
>
> https://wiki.php.net/rfc/readonly_hooks
>
> --
>   Larry Garfield
>   la...@garfieldtech.com
>


-- 
Volker Dusch
Head of Engineering
Tideways GmbH
Königswinterer Str. 116
53227 Bonn
https://tideways.io/imprint

Sitz der Gesellschaft: Bonn
Geschäftsführer: Benjamin Außenhofer (geb. Eberlei)
Registergericht: Amtsgericht Bonn, HRB 22127

Reply via email to