Re: Nullable types and strict type-hinting with default null value

From: Date: Sun, 26 Feb 2017 02:47:07 +0000
Subject: Re: Nullable types and strict type-hinting with default null value
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-98356@lists.php.net to get a copy of this message
Hi! > Scalar types declarations were introduced in PHP 7.0 but it was not > possible to pass null as a default value to function/method. It was > finally done by a small workaround described in documentation as "The > declaration can be made to accept NULL values if the default value of > the parameter is set to NULL". If removing it would make scalar types work differently from non-scalar types, it's not a good idea. Also, I don't see a reason why not have both declarations mean nullable type - the intent is clear in both cases, it's not like it can be confused with something else. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#98356) next »