Re: Nullable types and strict type-hinting with default null value
| From: | Rowan Collins | Date: | Thu, 23 Feb 2017 08:58:04 +0000 |
| Subject: | Re: Nullable types and strict type-hinting with default null value | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98344@lists.php.net to get a copy of this message | ||
On 23 February 2017 07:23:02 GMT+00:00, Andrey Andreev <narf@devilix.net> wrote:
>Hi,
>
>On Wed, Feb 22, 2017 at 11:18 PM, Michał <aaatoja@o2.pl> wrote:
>
>> "The
>declaration
>> can be made to accept NULL values if the default value of the
>parameter is
>> set to NULL".
>
>This isn't just a PHP 7 work-around for null types, it has existed
>since
>object type hints were introduced and is very widespread.
Indeed, it's far too early to think about forcing people to change all their code to the ?
notation. I'm also not convinced of the value even once that's established; it's not
like "Foo $foo = null" can ever mean *something different* from "?Foo $foo =
null", it would just be an error.
Maybe in 10 years' time we'll have another bonfire of unused features, and this might be
one, but it's not something we can plan for right now.
Regards,
--
Rowan Collins
[IMSoP]