public static function create($function) : \ReflectionFunctionAbstract
    {
        if (\is_string($function)) {
            return \strpos($function, '::') ? new \ReflectionMethod($function) : new \ReflectionFunction($function);
        }

        if (\is_array($function)) {
            return (new \ReflectionClass(\ReflectionMethod::class))->newInstanceArgs($function);
        }

        if (\method_exists($function, '__invoke')) {
            return new \ReflectionMethod($function, '__invoke');
        }

        return new \ReflectionFunction($function);
    }
public static function create($function) : \ReflectionFunctionAbstract
    {
        if (\is_string($function)) {
            return \strpos($function, '::') ? new \ReflectionMethod($function) : new \ReflectionFunction($function);
        }

        if (\is_array($function)) {
            return (new \ReflectionClass(\ReflectionMethod::class))->newInstanceArgs($function);
        }

        if (\method_exists($function, '__invoke')) {
            return new \ReflectionMethod($function, '__invoke');
        }

        return new \ReflectionFunction($function);
    }
public static function create ( $ function ) : \ ReflectionFunctionAbstract { if ( \ is_string ( $ function ) ) { return \ strpos ( $ function , '::' ) ? new \ ReflectionMethod ( $ function ) : new \ ReflectionFunction ( $ function ) ; } if ( \ is_array ( $ function ) ) { return ( new \ ReflectionClass ( \ ReflectionMethod :: class ) ) -> newInstanceArgs ( $ function ) ; } if ( \ method_exists ( $ function , '__invoke' ) ) { return new \ ReflectionMethod ( $ function , '__invoke' ) ; } return new \ ReflectionFunction ( $ function ) ; }
Creates a reflection for a given function.

@param callable|string $function A callable or a string representing a class method (non-static, delimited by ::)

@throws \ReflectionException

@return \ReflectionFunction|\ReflectionMethod
Creates a reflection for a given function .