Hi!

Most modern languages allow returning null in any case. This is a hail
Mary in the event something happens, but throwing an exception is
inappropriate. I see no reason to diverge from that.

In PHP, returning object if everything is OK and false if not is a very common pattern.
Also, you understand that always allowing null means that this construct:

$foo = $this->returnsFoo();
$foo->fooMethod();

is no longer safe as you wanted it to be when you made returnsFoo use strict typing? You'd have to check $foo anyway.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to