public static function getArity($callable)
    {
        if (is_object($callable)) {
            foreach (['__invoke', 'handle'] as $method) {
                if (! method_exists($callable, $method)) {
                    continue;
                }

                $r = new ReflectionMethod($callable, $method);
                return $r->getNumberOfRequiredParameters();
            }
            return 0;
        }

        if (! is_callable($callable)) {
            return 0;
        }

        $r = new ReflectionFunction($callable);
        return $r->getNumberOfRequiredParameters();
    }
public static function getArity($callable)
    {
        if (is_object($callable)) {
            foreach (['__invoke', 'handle'] as $method) {
                if (! method_exists($callable, $method)) {
                    continue;
                }

                $r = new ReflectionMethod($callable, $method);
                return $r->getNumberOfRequiredParameters();
            }
            return 0;
        }

        if (! is_callable($callable)) {
            return 0;
        }

        $r = new ReflectionFunction($callable);
        return $r->getNumberOfRequiredParameters();
    }
public static function getArity ( $ callable ) { if ( is_object ( $ callable ) ) { foreach ( [ '__invoke' , 'handle' ] as $ method ) { if ( ! method_exists ( $ callable , $ method ) ) { continue ; } $ r = new ReflectionMethod ( $ callable , $ method ) ; return $ r -> getNumberOfRequiredParameters ( ) ; } return 0 ; } if ( ! is_callable ( $ callable ) ) { return 0 ; } $ r = new ReflectionFunction ( $ callable ) ; return $ r -> getNumberOfRequiredParameters ( ) ; }
Get the arity of a handler

@param string|callable|object $callable
@return int
Get the arity of a handler