On Mon, 22 Jan 2024 at 11:51, Gina P. Banyard <intern...@gpb.moe> wrote:
> Hello internals, > > Máté Kocsis and myself would like to propose deprecating implicitly > nullable parameter types. > > The RFC is available on the wiki at the following address: > https://wiki.php.net/rfc/deprecate-implicitly-nullable-types > > > Best regards, > > Gina P. Banyard > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > I just encountered this language inconsistency when trying to remove nullable from a constructor-promoted property: ``` class MyClass { public function __construct( public ?string $title = null // removing "?" here causes "Fatal error: Cannot use null as default value" ) { $this->title = $title ?: resolveTitle(); } } ``` Which is fine, there's a simple workaround, it was just surprising.