Re: [PHP-DEV] [RFC] Type hints
Andi Gutmans <andi <at> zend.com>
2004-05-02 16:09:22 GMT
It probably makes sense to go with (3) because as Zeev says, the majority
of the times you don't want to allow NULL.
If we decide to go this direction we definitely need to implement it before
PHP 5 because otherwise it'll be a big BC break.
I wouldn't use the syntax you proposed but you:
function func(MyClass $obj or null);
Concerning type hints, I don't think that a type hint of "class" is useful.
If you don't use a base class as a type hint (which you will almost always
use) then how useful will this really be? Also, it's not really Class but
it's an Object, so we'd have to add another reserved word. In my opinion,
I'd only go with the "array" part of the typehints patch.
On another note, I think PHP 5 is already stable and quite mature. It's an
order of magnitude more stable than PHP 4 was when it was released. I think
we should start thinking of a deep feature freeze and a release date. As
we're in the beginning of May I think sometime towards July makes sense.
This does mean that we really need to stop adding stuff. I agree to open
the typehints issue because it could potentially lead to a BC break
depending what solution we take.
At 10:09 PM 5/1/2004 +0200, Marcus Boerger wrote:
> while working with php 5 the last days i find it more and more
>annoying that we allow NULL with type hints. From my perspective