public static function getReflectionMethod($object, string $method)
    {
        assert(is_object($object));

        if (method_exists($object, $method)) {
            return new ReflectionMethod($object, $method);
        }

        // if method does not exist, but it is callable, that means it has a magic caller.
        if (! is_callable([$object, $method])) {
            return false;
        }

        // it is not easy to detect each implementation of __call or __callStatic automatically.
        foreach (static::$customReflections as $className => $callback) {
            if (is_a($object, $className)) {
                return $callback($object, $method);
                break;
            }
        }

        return false;
    }
public static function getReflectionMethod($object, string $method)
    {
        assert(is_object($object));

        if (method_exists($object, $method)) {
            return new ReflectionMethod($object, $method);
        }

        // if method does not exist, but it is callable, that means it has a magic caller.
        if (! is_callable([$object, $method])) {
            return false;
        }

        // it is not easy to detect each implementation of __call or __callStatic automatically.
        foreach (static::$customReflections as $className => $callback) {
            if (is_a($object, $className)) {
                return $callback($object, $method);
                break;
            }
        }

        return false;
    }
public static function getReflectionMethod ( $ object , string $ method ) { assert ( is_object ( $ object ) ) ; if ( method_exists ( $ object , $ method ) ) { return new ReflectionMethod ( $ object , $ method ) ; } // if method does not exist, but it is callable, that means it has a magic caller. if ( ! is_callable ( [ $ object , $ method ] ) ) { return false ; } // it is not easy to detect each implementation of __call or __callStatic automatically. foreach ( static :: $ customReflections as $ className => $ callback ) { if ( is_a ( $ object , $ className ) ) { return $ callback ( $ object , $ method ) ; break ; } } return false ; }
Tries to find the correct reflection method.

@throws \ReflectionException

@param object $object
@param string $method
@return bool|\ReflectionMethod
Tries to find the correct reflection method .