Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105212 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23305 invoked from network); 10 Apr 2019 18:50:09 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 10 Apr 2019 18:50:09 -0000 To: internals@lists.php.net References: <5cadfed8.1c69fb81.31f7d.1c49SMTPIN_ADDED_MISSING@mx.google.com> Date: Wed, 10 Apr 2019 16:47:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Posted-By: 94.0.205.114 Subject: Re: [PHP-DEV] [RFC] Nullable Casting From: markyr@gmail.com (Mark Randall) Message-ID: On 10/04/2019 16:16, Guilliam Xavier wrote: > var_dump((?int) $obj); // would you want it to print `NULL`? > var_dump((?string) $obj); // would you want it to print `NULL`? I believe returning null in those situations makes the most intuative sense, yes. > var_dump((int) $obj); // Notice, then prints `int(1)` In the absense of a nullable modifier, that makes so little sense that it definitely needs to throw a TypeError IMO. -- Mark Randall