Merge branch '7.4' into 8.0

* 7.4:
  [HttpFoundation] Deprecate null $format argument to Request::setFormat()
This commit is contained in:
Nicolas Grekas
2025-11-02 09:41:28 +01:00
4 changed files with 6 additions and 2 deletions

View File

@@ -96,6 +96,7 @@ HttpFoundation
* Deprecate using `Request::sendHeaders()` after headers have already been sent; use a `StreamedResponse` instead
* Deprecate method `Request::get()`, use properties `->attributes`, `query` or `request` directly instead
* Deprecate HTTP method override for methods GET, HEAD, CONNECT and TRACE; it will be ignored in Symfony 8.0
* Deprecate accepting null `$format` argument to `Request::setFormat()`
HttpKernel
----------

View File

@@ -218,6 +218,7 @@ HttpFoundation
* Add argument `$partitioned` to `ResponseHeaderBag::clearCookie()`
* Add argument `$expiration` to `UriSigner::sign()`
* Remove `Request::get()`, use properties `->attributes`, `query` or `request` directly instead
* Remove accepting null `$format` argument to `Request::setFormat()`
HttpClient
----------

View File

@@ -12,6 +12,7 @@ CHANGELOG
* Add argument `$partitioned` to `ResponseHeaderBag::clearCookie()`
* Add argument `$expiration` to `UriSigner::sign()`
* Remove `Request::get()`, use properties `->attributes`, `query` or `request` directly instead
* Remove accepting null `$format` argument to `Request::setFormat()`
7.4
---
@@ -24,6 +25,7 @@ CHANGELOG
* Deprecate method `Request::get()`, use properties `->attributes`, `query` or `request` directly instead
* Make `Request::createFromGlobals()` parse the body of PUT, DELETE, PATCH and QUERY requests
* Deprecate HTTP method override for methods GET, HEAD, CONNECT and TRACE; it will be ignored in Symfony 8.0
* Deprecate accepting null `$format` argument to `Request::setFormat()`
7.3
---

View File

@@ -1335,13 +1335,13 @@ class Request
*
* @param string|string[] $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type)
*/
public function setFormat(?string $format, string|array $mimeTypes): void
public function setFormat(string $format, string|array $mimeTypes): void
{
if (null === static::$formats) {
static::initializeFormats();
}
static::$formats[$format ?? ''] = (array) $mimeTypes;
static::$formats[$format] = (array) $mimeTypes;
}
/**