Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81946 invoked from network); 25 Feb 2017 15:12:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2017 15:12:39 -0000 X-Host-Fingerprint: 95.148.67.80 unknown Received: from [95.148.67.80] ([95.148.67.80:29013] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/D6-11648-6EE91B85 for ; Sat, 25 Feb 2017 10:12:39 -0500 Message-ID: <60.D6.11648.6EE91B85@pb1.pair.com> To: internals@lists.php.net References: <011257B7-C709-4652-909C-5F2B02B0A2E4@gmail.com> Date: Sat, 25 Feb 2017 15:12:35 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: <011257B7-C709-4652-909C-5F2B02B0A2E4@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 95.148.67.80 Subject: Re: [PHP-DEV] Nullable types and strict type-hinting with default null value From: ajf@ajf.me (Andrea Faulds) Hi, Rowan Collins wrote: > On 23 February 2017 09:15:27 GMT+00:00, "MichaƂ" wrote: >> And what about situation when someone is forcing >> declare(strict_types=1)? I think, it's really a good place to force >> proper types. Including nulls. > > strict_types controls the behaviour of *calling* functions, but the check here would have to be when *defining* the function: it would give an error that the function definition is invalid, like if you say function foo(int $bar='hello') > > Unless you had some other behaviour in mind? In addition to this, if we wanted to prohibit implicit nullability in parameter definitions, we should have done it when we introduced declare(strict_types=1); in the first place, and that ship has sailed. -- Andrea Faulds https://ajf.me/