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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to