No thread found. Threads are linked to an RFC when their first email links to the RFC page, or when the RFC page links to them.
Copied from wiki.php.net, last synchronized Oct 13, 2026 11:52 UTC
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.
callback is callable, the opposite could not be true. A string, or a closure, is callable, but the string is not a callback.
The documentations already use `array` hinting when a function expects an array, even though it does not type hint on it. The documentations already use `callable` hiting when a function expects a callable instance, even though it does not type hint on it.
Furthermore we already have a function called is_callable(), and this new feature will share its implementation.
Introducing a different name (i..e callback) will therefore only create more inconsistencies and confusion.
The callable typehint reuses the is_callable() logic.
Only null initialize is allowed, making it consistent with classname typehinting.