Re: Nullsafe

From: Date: Tue, 03 Nov 2020 18:33:20 +0000
Subject: Re: Nullsafe
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-112161@lists.php.net to get a copy of this message
On Tue, 3 Nov 2020 at 16:48, Benjamin Morel <benjamin.morel@gmail.com> wrote: > On Tue, 3 Nov 2020 at 17:38, Eugene Sidelnyk <zsidelnik@gmail.com> wrote: > > > I am wondering why don't we use ordinary -> > > operator with safe null > > handling? > Implicit nullable is terrible, moreover I don't see why users should return null values more often. They serve their purpose but most of the time you can use another sane/safe default of the given property type. Moreover, I don't see the issue with another operator as it conveys *clear* intent especially in PHP as everything is null by default (might warn but still). *Technically* this isn't a BC break, but it's an enormous change of semantics for something which is worse IMHO. Also the operator has already been voted on, accepted, and implemented. Regards, George P. Banyard

« previous php.internals (#112161) next »