[HttpKernel] Support variadic with #[MapRequestPayload]#54817
Merged
nicolas-grekas merged 1 commit intosymfony:8.1from Feb 12, 2026
Merged
[HttpKernel] Support variadic with #[MapRequestPayload]#54817nicolas-grekas merged 1 commit intosymfony:8.1from
#[MapRequestPayload]#54817nicolas-grekas merged 1 commit intosymfony:8.1from
Conversation
c08c101 to
fc7b7c8
Compare
fc7b7c8 to
06f4c22
Compare
06f4c22 to
4d87be0
Compare
nicolas-grekas
approved these changes
Feb 12, 2026
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
I rebased the PR for 8.1 and fixed a few things in the implementation.
Member
|
Thank you @DjordyKoert. |
There was a problem hiding this comment.
Pull request overview
Adds variadic controller argument support for #[MapRequestPayload] in HttpKernel’s controller argument resolver pipeline, and adjusts variadic handling to avoid passing arrays where individual variadic arguments are expected.
Changes:
- Update
RequestPayloadValueResolverto allow variadic mapping for#[MapRequestPayload]and expand resolved values into controller arguments. - Extend/adjust test coverage for variadic request payload mapping and uploaded file mapping.
- Document the new feature in the HttpKernel changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php | Enables variadic payload mapping and expands variadic arguments during KernelEvents::CONTROLLER_ARGUMENTS. |
| src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/RequestPayloadValueResolverTest.php | Adds tests for variadic #[MapRequestPayload] (form params + JSON array). |
| src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UploadedFileValueResolverTest.php | Updates the variadic uploaded-file test to assert the new argument shape. |
| src/Symfony/Component/HttpKernel/CHANGELOG.md | Records the feature addition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Show resolved
Hide resolved
...ony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UploadedFileValueResolverTest.php
Show resolved
Hide resolved
nicolas-grekas
added a commit
that referenced
this pull request
Feb 12, 2026
…adedFile] (nicolas-grekas) This PR was merged into the 7.4 branch. Discussion ---------- [HttpKernel] Fix variadic argument handling with #[MapUploadedFile] | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Looks like #49978 was buggy, spotted while reviewing #54817 Commits ------- 75a8c42 [HttpKernel] Fix variadic argument handling with #[MapUploadedFile]
javiereguiluz
added a commit
to symfony/symfony-docs
that referenced
this pull request
Feb 16, 2026
…ad] (lacatoire) This PR was merged into the 8.1 branch. Discussion ---------- Document variadic argument support for #[MapRequestPayload] This documents the support for variadic arguments with `#[MapRequestPayload]`, introduced in Symfony 8.1 via symfony/symfony#54817. ## Changes Added a code example in `controller.rst` showing that you can use a variadic argument (`UserDto ...$users`) as an alternative to the existing `array` + `type` option approach for mapping arrays of DTOs from request payloads. Fixes #21961 Commits ------- b575738 Document variadic argument support for #[MapRequestPayload]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for variadic arguments in combination with
#[MapRequestPayload].Example request
Example controller usage
This PR also fixes a bug introduced in #49978 where using
#[MapUploadedFile]with a variadic argument causes aTypeError: