Using the following function:
function is_closure($t) { return ( !is_string($t) && is_callable($t)); }
Can this return true for anything else, than an anonymous closure function? If so, what would be the correct way to determine, if a variable is a closure?
Many thanks
The most deterministic way to check if a callback is an actual closure is:
All anonymous functions are represented as objects of the type
Closurein PHP. (Which, coming back to above comment, happen to implement the__invoke()method.)