nategood / commando

An Elegant CLI Library for PHP
MIT License
798 stars 80 forks source link

Closures vs callable #64

Open edhaase opened 8 years ago

edhaase commented 8 years ago

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

NeoVance commented 8 years ago

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.

HarryR commented 8 years ago

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