Stas already pointed out that parameter typehints allow you to define
the interface for your method. Return typehints would server a similar
purpose and as such I'd consider them useful. But "variable" typehints
don't serve any such purpose.

I gave an example validating an array of Foo instances, which the current system doesn't solve. Of course PHP could extend argument typehints to describe this, but Stas *just* said he doesn't want generics and so on in PHP.

All right, I don't either. I just want a clean way to describe my expectation that a variable is what it is, and assuming that all function arguments are one single instance simply doesn't match the real world out there. People iterate arrays, they pass arrays around. And they have expectations for what's inside those arrays.

Stan

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

Reply via email to