This can be simplified with elseif ($listener instanceof Closure)