On Wed, Aug 15, 2012 at 11:17 AM, Stan Vass <sv_for...@fmethod.com> wrote: > You're 10 years too late to argue the merits of typehints in PHP. > > I am not proposing the introduction of typehints. I'm just saying "we have > the option to use them in arguments, let's have the options inline too." > This way we can validate expressions and structures we can't today, in a > minimal, readable, consistent, easy to maintain way.
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. Actually, one could even say that they don't serve *any* purpose, short of providing the IDE with type information, because your code would work just as well even without the type check. If the type were wrong, it would just throw a fatal error when trying to do something with it (like invoking a method that does not exist). And if the sole purpose is type hinting for the IDE, then I don't see what's wrong with the established system of PHPDoc comments. They seem to serve the same purpose, don't they? Nikita -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php