Re: [RFC] Nullable Casting
| From: | Mark Randall | Date: | Wed, 10 Apr 2019 15:47:18 +0000 |
| Subject: | Re: [RFC] Nullable Casting | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105212@lists.php.net to get a copy of this message | ||
On 10/04/2019 16:16, Guilliam Xavier wrote:
var_dump((?int) $obj); // would you want it to printI believe returning null in those situations makes the most intuative sense, yes.NULL? var_dump((?string) $obj); // would you want it to printNULL?
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