I think it's hard to put closure on this type hints issue.
The main problem as I see it, is that most PHP users, unlike Java users, usually do pass instantiated objects to functions which except objects, and as mentioned here, people would like to do $obj->method() without having to test for NULL. This pretty much means that we need to allow a type hint mechanism to not allow null.
As no good syntax has been found for the less common case of allowing NULL's, I think the best solution for now is not to allow null in the regular type hint syntax, and have people who want to allow NULL's not use type hints at all (in any case, they need to manually check their parameter so they'll do one more manual check).
We can then wait and see how much feedback we receive on this issue after 5.0 and if necessary, revisit this. In any case, if the default is not to allow null pretty much any solution we will come up with will keep BC.


That's my 2c.
Andi

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



Reply via email to