Repository: symfony/symfony
File: src/Symfony/Component/HttpFoundation/Request.php (PHP)

Code before:
     */
    public static function getMimeTypes(string $format): array
    {
        if (null === static::$formats) {
            static::initializeFormats();
        }

        return static::$formats[$format] ?? [];
    }

    /**
     * Gets the format associated with the mime type.
     *
     *  Resolution order:
     *   1) Exact match on the full MIME type (e.g. "application/json").
     *   2) Match on the canonical MIME type (i.e. before the first ";" parameter).
     *   3) If the type is "application/*+suffix", use the structured syntax suffix
     *      mapping (e.g. "application/foo+json" → "json"), when available.
     *   4) If $subtypeFallback is true and no match was found:
     *      - return the MIME subtype (without "x-" prefix), provided it does not
     *        contain a "+" (e.g. "application/x-yaml" → "yaml", "text/csv" → "csv").
     *
     * @param string|null $mimeType        The mime type to check
     * @param bool        $subtypeFallback Whether to fall back to the subtype if no exact match is found
     */
    public function getFormat(?string $mimeType, /*bool $subtypeFallback = false*/): ?string
    {
        $subtypeFallback = 2 <= \func_num_args() ? func_get_arg(1) : false;
        $canonicalMimeType = null;
        if ($mimeType && false !== $pos = strpos($mimeType, ';')) {
            $canonicalMimeType = trim(substr($mimeType, 0, $pos));
        }

        if (null === static::$formats) {
            static::initializeFormats();
        }

        foreach (static::$formats as $format => $mimeTypes) {
            if (\in_array($mimeType, (array) $mimeTypes, true)) {
                return $format;
            }
            if (null !== $canonicalMimeType && \in_array($canonicalMimeType, (array) $mimeTypes, true)) {
                return $format;
            }
        }

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

        if (str_starts_with($canonicalMimeType, 'application/') && str_contains($canonicalMimeType, '+')) {

Review comment (suggestion):
```suggestion
    public function getFormat(?string $mimeType/* , bool $subtypeFallback = false */): ?string
```

Code after:
     */
    public static function getMimeTypes(string $format): array
    {
        if (null === static::$formats) {
            static::initializeFormats();
        }

        return static::$formats[$format] ?? [];
    }

    /**
     * Gets the format associated with the mime type.
     *
     *  Resolution order:
     *   1) Exact match on the full MIME type (e.g. "application/json").
     *   2) Match on the canonical MIME type (i.e. before the first ";" parameter).
     *   3) If the type is "application/*+suffix", use the structured syntax suffix
     *      mapping (e.g. "application/foo+json" → "json"), when available.
     *   4) If $subtypeFallback is true and no match was found:
     *      - return the MIME subtype (without "x-" prefix), provided it does not
     *        contain a "+" (e.g. "application/x-yaml" → "yaml", "text/csv" → "csv").
     *
     * @param string|null $mimeType        The mime type to check
     * @param bool        $subtypeFallback Whether to fall back to the subtype if no exact match is found
     */
    public function getFormat(?string $mimeType/* , bool $subtypeFallback = false */): ?string
    {
        $subtypeFallback = 2 <= \func_num_args() ? func_get_arg(1) : false;
        $canonicalMimeType = null;
        if ($mimeType && false !== $pos = strpos($mimeType, ';')) {
            $canonicalMimeType = trim(substr($mimeType, 0, $pos));
        }

        if (null === static::$formats) {
            static::initializeFormats();
        }

        foreach (static::$formats as $format => $mimeTypes) {
            if (\in_array($mimeType, (array) $mimeTypes, true)) {
                return $format;
            }
            if (null !== $canonicalMimeType && \in_array($canonicalMimeType, (array) $mimeTypes, true)) {
                return $format;
            }
        }

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

        if (str_starts_with($canonicalMimeType, 'application/') && str_contains($canonicalMimeType, '+')) {