public static function guess(string $guess): ?string
    {
        $guessers = self::getGuessers();

        if (\count($guessers) === 0) {
            $msg = 'Unable to guess the mime type as no guessers are available';

            if (! MimeTypeFileInfoGuesser::isSupported()) {
                $msg .= ' (Did you enable the php_fileinfo extension?).';
            }

            throw new \LogicException($msg);
        }

        $exception = null;

        foreach ($guessers as $guesser) {
            try {
                $mimeType = $guesser::guess($guess);
            } catch (RuntimeException $e) {
                $exception = $e;

                continue;
            }

            if ($mimeType !== null) {
                return $mimeType;
            }
        }

        // Throw the last catched exception.
        if ($exception !== null) {
            throw $exception;
        }

        return null;
    }