On Thu, 26 Aug 2021 at 12:42, Björn Larsson via internals <internals@lists.php.net> wrote: > > Den 2021-08-10 kl. 11:55, skrev Philip Hofstetter: > > The following valid <= PHP 8.0 code that intends to make the $line property > > public is a fatal error in 8.1 .... > > > > For method return types, we have #[ReturnTypeWillChange], but for property > > types 🤷♀️
> Hi, > > Has this been adressed / solved in some way and does it needs > to be fixed? My understanding is that the two scenarios are not the same and that there isn't much enthusiasm for 'fixing' it. For return types, the #[ReturnTypeWillChange] annotation is a temporary work-around, and one that would be used by a lot of people. It would only be used by a library until that library drops support for older versions of PHP. For the exception case, the way that (for legacy reasons) PHP supports having a public property in a child class that "overwrites" (mostly) the protected property in the parent class, is a pretty hinkey thing to do, and so this is likely to only affect a small number of people. It's not obvious to me how long a bridging annotation would need to hang around for, and it's really not obvious what the exact details of how it would work would be. I'd suggest using a getter method, which would work on all relevant versions. cheers Dan Ack -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php