Re: 8.1 / Exception / Property Type / Backwards compatbility

From: Date: Thu, 26 Aug 2021 14:42:36 +0000
Subject: Re: 8.1 / Exception / Property Type / Backwards compatbility
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-115858@lists.php.net to get a copy of this message
Philip Hofstetter wrote on 8/10/21 04:55: > Hello > > The following valid <= PHP 8.0 code that intends to make the $line property > public is a fatal error in 8.1 > > class FooException extends Exception { > public $line; > } > > However, the fixed code for 8.1: > > class FooException extends Exception { > public int $line; > } > > Is a fatal error in <= 8.0 > > Is there a way to create a class that makes the $line property public > that’s compatible with all versions of PHP without requiring conditional > declaration of the class? > > For method return types, we have #[ReturnTypeWillChange], but for property > types 🤷‍♀️ This sounds like a bug. I don't see this reported yet in the bug tracker. Please open an issue at https://bugs.php.net Cheers, Ben

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#115858) next »