Re: Non-nullable properties

From: Date: Mon, 16 Jul 2018 16:07:42 +0000
Subject: Re: Non-nullable properties
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-102855@lists.php.net to get a copy of this message
I agree with you. If someone really wants to have an "uninitialized" field on purpose, they should do that using the correct type declaration, i.e.: ?MyType $myNullable = null; When this was started I asked if it was possible to check types right after object has been constructed, but they said it was inefficient to do so. If this is still true, then I'm ok with checking on first access instead. I don't want even more overhead from runtime type checking. This is definitely not as bad as the "billion dollar mistake" though. The error still happens, but in a different place.

« previous php.internals (#102855) next »