Re: Re: 8.1 / Exception / Property Type / Backwards compatbility

From: Date: Thu, 26 Aug 2021 19:57:14 +0000
Subject: Re: Re: 8.1 / Exception / Property Type / Backwards compatbility
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-115866@lists.php.net to get a copy of this message
On Thu, Aug 26, 2021 at 8:34 PM Ben Ramsey <ramsey@php.net> wrote: > Nikita Popov wrote on 8/26/21 09:57: > > Right. I at least do not plan to address this issue. If you take a > > protected property and publicly re-export it, then any compatibility > issues > > are on you. > > This does not appear to affect only cases where one is re-exporting a > protected property as public. > > Exception protected properties without type hints: > > * PHP <= 8.0 - https://3v4l.org/GWmrk > * PHP 8.1 - https://3v4l.org/GWmrk/rfc > > > Exception protected properties with type hints: > > * PHP <= 8.0 - https://3v4l.org/UX1Pa > * PHP 8.1 - https://3v4l.org/UX1Pa/rfc > These are not really meaningful examples, because you could simply not redeclare the property at all and assign it in the constructor instead (or preferably, let the parent constructor assign it). That's the normal way to extend exceptions. What made the original case interesting is that the property redeclaration isn't immediately redundant there, because it changes visibility. Regards, Nikita

« previous php.internals (#115866) next »