public static function write(string $fileName = '', $config = null): bool
    {
        $pathInfo = \pathinfo(static::normalizePath($fileName));
        if (!isset($pathInfo['extension'])) {
            $message = \sprintf(
                'Config file name "%s" is missing an extension and cannot be auto-detected',
                $pathInfo['filename']
            );

            throw new RuntimeException($message);
        }

        $extension = \strtolower($pathInfo['extension']);
        if (!\in_array($extension, static::$allowedExtensions)) {
            $message = \sprintf(
                'Unsupported config file type. Supported extension types are: %s',
                \implode(',', static::$allowedExtensions)
            );

            throw new RuntimeException($message);
        }

        if (!isset(static::$writers[$extension]) || !(static::$writers[$extension] instanceof AbstractWriter)) {
            static::$writers[$extension] = WriterManager::get($extension);
        }

        return static::$writers[$extension]->toFile($fileName, $config);
    }