commando icon indicating copy to clipboard operation
commando copied to clipboard

Closures vs callable

Open edhaase opened this issue 9 years ago • 2 comments
trafficstars

I was wondering if there was a particular reason why you're type hinting to \Closure instead of the less restrictive \Callable?

edhaase avatar Jun 11 '16 06:06 edhaase

There was no implementation for handling callable arrays [$object, "funcName"]. Basically, the author wanted to call the function directly rather than use call_user_func.

It would be a simple change to implement, but at the same time it is also very simple to pass in an anonymous function that calls whatever other functions you want.

NeoVance avatar Jul 20 '16 19:07 NeoVance

I agree, using call_user_func would be better, e.g. being able to do: must('file_exists')

HarryR avatar Sep 03 '16 18:09 HarryR