src/main/php/NewInstance.php
private static function reflect($class): \ReflectionClass
    {
        if (is_string($class) && (class_exists($class) || interface_exists($class) || trait_exists($class))) {
            return new \ReflectionClass($class);
        } elseif (is_object($class)) {
            return new \ReflectionObject($class);
        }

        throw new \InvalidArgumentException(
                'Given class must either be an existing class, interface or'
                . ' trait name or class instance, ' . \gettype($class)
                . ' with value "' . $class . '" given'
        );
    }
private static function reflect($class): \ReflectionClass
    {
        if (is_string($class) && (class_exists($class) || interface_exists($class) || trait_exists($class))) {
            return new \ReflectionClass($class);
        } elseif (is_object($class)) {
            return new \ReflectionObject($class);
        }

        throw new \InvalidArgumentException(
                'Given class must either be an existing class, interface or'
                . ' trait name or class instance, ' . \gettype($class)
                . ' with value "' . $class . '" given'
        );
    }
private static function reflect ( $ class ) : \ ReflectionClass { if ( is_string ( $ class ) && ( class_exists ( $ class ) || interface_exists ( $ class ) || trait_exists ( $ class ) ) ) { return new \ ReflectionClass ( $ class ) ; } elseif ( is_object ( $ class ) ) { return new \ ReflectionObject ( $ class ) ; } throw new \ InvalidArgumentException ( 'Given class must either be an existing class, interface or' . ' trait name or class instance, ' . \ gettype ( $ class ) . ' with value "' . $ class . '" given' ) ; }
reflects given class value

@param   string|object  $class
@return  \ReflectionClass
@throws  \InvalidArgumentException
reflects given class value