Le mar. 24 févr. 2026 à 20:57, Larry Garfield <[email protected]> a
écrit :

> On Tue, Feb 24, 2026, at 1:34 PM, Nicolas Grekas wrote:
>
> >> Otherwise, I'm happy with where this ended up.  Thanks!
> >>
> >
> > Thanks for having a look!
> > Here is the update:
> >
> https://wiki.php.net/rfc/promoted_readonly_constructor_reassign?do=diff&rev2%5B0%5D=1771797005&rev2%5B1%5D=1771961558&difftype=sidebyside
> >
> > Cheers,
> > Nicolas
>
> > Property hooks cannot be combined with CPP, so properties must be
> declared separately
>
> This is untrue.  The following code is legal:
>
> class Point {
>     public function __construct(
>         public float $x = 0.0 { set => abs($value); },
>         public float $y = 0.0 { set => abs($value); },
>     ) {}
> }
>
> The point about readonly is valid, and worth keeping, as is the "affects
> all writes" question, but the code above is possible.
>
>
My bad, I should get used to them more :)

https://wiki.php.net/rfc/promoted_readonly_constructor_reassign?do=diff&rev2%5B0%5D=1771961558&rev2%5B1%5D=1771972141&difftype=sidebyside

Reply via email to