On 2011-06-06, Hannes Magnusson <hannes.magnus...@gmail.com> wrote: > On Sun, Jun 5, 2011 at 17:52, Felipe Pena <felipe...@gmail.com> wrote: > > Reading our bug tracker I noticed a good feature request [1] from 2009 which > > points to an interesting feature that I think makes sense for us, since we > > are now working with $f() using objects and strings, and the array('class', > > 'method') is an old known for call_user_func()-like functions. > > I like it. > > I also think we should implement "callable" typehint. > A lot of framworks are now adopting Closure as a typehint for that, > which is annoying due to the fact you have to wrap anything else in a > closure just to pass that typehint.
Agreed. It's even more problematic because the manual clearly states that the "Closure" class is considered an implementation detail, and should not be relied upon. As such, if the implementation changes in the future, all those frameworks/libraries will need to refactor. And for those that try to do it "right," they need to jump through a fair bit of logic (test for object or string, test for array) in order to hand off execution properly. > Essentially the callable typehint would be the same as > is_callable($arg, true); > > That means I can pass in any string with a function name, an array > (with class+methodname), and a closure. +1. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php