-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpFoundation] Allow Request::setFormat() to override predefined formats #62246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Psalm failed because $format is nullable, but why is this allowed? What does it mean to pass null? Perhaps this was a mistake in https://github.com/symfony/symfony/pull/33088/files#diff-779a02ff90f6fc60228d531d684382d3b585b3c823ba53028ff8d2a9e03a2ea0R1314 |
0ab0396 to
2402d16
Compare
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased the PR on branch 6.4 because the root issue exists there: the last calls to setFormat should replace the previous ones.
I also updated the implementation to fix this in getFormat instead.
|
I have no idea why |
|
This looks like a mistake when adding the native type, as the old code was using symfony/src/Symfony/Component/HttpFoundation/Request.php Lines 1327 to 1330 in 9fec71e
|
|
Thank you @longwave. |
…est::setFormat() (longwave) This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [HttpFoundation] Deprecate null $format argument to Request::setFormat() | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | no | License | MIT Deprecates null `$format` argument to `Request::setFormat()` - as discovered in #62246 it makes no sense for this argument to be nullable. Commits ------- 7b18f1a [HttpFoundation] Deprecate null $format argument to Request::setFormat()
Since #61267 some additional MIME formats are predefined; in order to override the predefined formats you must explictly deregister them. This PR changes the order so formats added later take precedence.