PHP's callable
meta type can be:
- a string
- an array
- an anonymous function
Only the latter one is somewhat "type safe", i.e. if you get an anonymous function you know it's something you can call. The other two options are merely formalised informal standards (if that makes sense) which are supported by a few functions that accept callbacks; they're not actually a type in PHP's type system. Therefore there's basically no guarantee you can make about them.
You can only work around this by checking whether the callable
you got is, well, callable using is_callable
before you execute them. You could wrap this into your own class, for example, to actually create a real callable type.