This is an old revision of the document!
Request for Comments: Parameter type specification
Various RFCs that have been proposed for parameter and return typing.
PHP is a dynamically typed language, that does automatic type juggling where ever possible. With PHP 5 a new feature called "type hinting" was introduced for arrays and objects. However the name “hint” is a bit misnamed, since triggers an E_RECOVERABLE_ERROR. While a fatal error can be prevented with an error handler, its not really nicely doable, since this needs to happen in a global error handler, far away in terms of code from the original context. It also comes with quite an overhead.
- Return value type hint by Felipe
- Return value type hint by Will Fitch
- Return value and parameter type hint by Felipe
- Strict and weak parameter type checking by Lukas and Zeev
- Optional Strict Type Checking for Scalars by Paul (Ilia's proposal)
- Parser and Reflection-API only Type Hints by Derick (Implemented)
- Parameter Type Casting Hints by Anthony