Hacker News new | ask | show | jobs
by TazeTSchnitzel 4349 days ago
Scalar (int, float, string) type hinting may be added in a future PHP version, and there's currently an RFC for return types (I expect it'll pass myself). PHP already let you type hint for classses.
2 comments

You can also hint on interfaces. If strict typing is important, I use the SPL primitive wrapper classes like SplString or SplInt http://php.net/manual/en/class.spltype.php
Cool! I wasn't aware of the RFC. Must be this one then? https://wiki.php.net/rfc/returntypehinting
Yep.