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

Code before:
    }

    /**
     * Structured MIME suffix fallback formats
     *
     * This mapping is used when no exact MIME match is found in $formats.
     * It enables handling of types like application/soap+xml → 'xml'.
     *
     * @see https://datatracker.ietf.org/doc/html/rfc6839
     * @see https://datatracker.ietf.org/doc/html/rfc7303
     *
     * @return list<string>
     */
    private static function getStructuredSuffixFormats(): array
    {
        return [
            'json'   => 'json',
            'xml'    => 'xml',
            'xhtml'  => 'html',
            'cbor'   => 'cbor',
            'zip'    => 'zip',
            'ber'    => 'asn1',
            'der'    => 'asn1',
            'tlv'    => 'tlv',
            'wbxml'  => 'xml',
            'yaml'   => 'yaml',
        ];
    }

    private function setPhpDefaultLocale(string $locale): void
    {
        // if either the class Locale doesn't exist, or an exception is thrown when
        // setting the default locale, the intl module is not installed, and
        // the call can be ignored:
        try {
            if (class_exists(\Locale::class, false)) {
                \Locale::setDefault($locale);
            }
        } catch (\Exception) {
        }
    }

    /**
     * Returns the prefix as encoded in the string when the string starts with
     * the given prefix, null otherwise.
     */
    private function getUrlencodedPrefix(string $string, string $prefix): ?string
    {
        if ($this->isIisRewrite()) {
            // ISS with UrlRewriteModule might report SCRIPT_NAME/PHP_SELF with wrong case
            // see https://github.com/php/php-src/issues/11981

Review comment (suggestion):
```suggestion
            'json'  => 'json',
            'xml'   => 'xml',
            'xhtml' => 'html',
            'cbor'  => 'cbor',
            'zip'   => 'zip',
            'ber'   => 'asn1',
            'der'   => 'asn1',
            'tlv'   => 'tlv',
            'wbxml' => 'xml',
            'yaml'  => 'yaml',
```

Code after:
            'xml' => ['text/xml', 'application/xml', 'application/x-xml'],
            'rdf' => ['application/rdf+xml'],
            'atom' => ['application/atom+xml'],
            'rss' => ['application/rss+xml'],
            'form' => ['application/x-www-form-urlencoded', 'multipart/form-data'],
            'soap' => ['application/soap+xml'],
            'problem' => ['application/problem+json'],
            'hal' => ['application/hal+json', 'application/hal+xml'],
            'jsonapi' => ['application/vnd.api+json'],
            'yaml' => ['text/yaml', 'application/x-yaml'],
            'wbxml' => ['application/vnd.wap.wbxml'],
            'pdf' => ['application/pdf'],
            'csv' => ['text/csv'],
        ];
    }

    /**
     * Structured MIME suffix fallback formats
     *
     * This mapping is used when no exact MIME match is found in $formats.
     * It enables handling of types like application/soap+xml → 'xml'.
     *
     * @see https://datatracker.ietf.org/doc/html/rfc6839
     * @see https://datatracker.ietf.org/doc/html/rfc7303
     * @see https://www.iana.org/assignments/media-types/media-types.xhtml
     *
     * @return array<string, string>
     */
    private static function getStructuredSuffixFormats(): array
    {
        return [
            'json' => 'json',
            'xml' => 'xml',
            'xhtml' => 'html',
            'cbor' => 'cbor',
            'zip' => 'zip',
            'ber' => 'asn1',
            'der' => 'asn1',
            'tlv' => 'tlv',
            'wbxml' => 'xml',
            'yaml' => 'yaml',
        ];
    }

    private function setPhpDefaultLocale(string $locale): void
    {
        // if either the class Locale doesn't exist, or an exception is thrown when
        // setting the default locale, the intl module is not installed, and
        // the call can be ignored:
        try {
            if (class_exists(\Locale::class, false)) {