On Fri, Aug 27, 2021 at 5:35 PM Ben Ramsey <ram...@php.net> wrote: > Nikita Popov wrote on 8/26/21 14:57: > > On Thu, Aug 26, 2021 at 8:34 PM Ben Ramsey <ram...@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. > > If we don't want downstream users to redeclare the properties, why are > they protected? >
To allow downstreams users to write $this->line = 123. Regards, Nikita