This is an old revision of the document!
Request for Comments: How to write RFCs
Frameworks have started to adopt Closures for callbacks, utilizing the 'Closure' typehint. That has an unfortunate sideeffect of requiring already-existing-methods to be wrapped into a closure calling that method. Additionally, the PHP documentation on closures indicates that the “Closure” class is considered an implementation detail, and may be subject to change in the future -- which means that typehinting on Closure may break in the future.
Introducing a callable typehint.
The typehint would allow a string with a function name, an array composed of classname/obj+methodname, and a closure.
- The only arguments against the idea came from Stas, making the argument;
- 'callable' are nothing different then 'balanced binary tree' and 'readable file', and none of them make sense to have typehints for.
- A “strict typing error” is hard to handle in user-space gracefully
- Everyone else seem to like the idea.
- As for the patch itself, Felipe pointed out that the patch is missing an method in ext/reflection to retrieve the typehint information.
- June 7th 2011, Initial writeup