Skip to content

[Validator] deprecate passing choices as $options argument to Choice constraint #61255

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

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jul 28, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? yes
Issues
License MIT

@carsonbot carsonbot added this to the 7.4 milestone Jul 28, 2025
@xabbuh xabbuh force-pushed the validator-choices branch 2 times, most recently from 5e30b16 to 78728d4 Compare July 28, 2025 07:28
@OskarStark OskarStark changed the title [Validator] deprecate passing choices as $options argument to Choice constraint [Validator] deprecate passing choices as $options argument to Choice constraint Jul 29, 2025
@nicolas-grekas
Copy link
Member

That makes me a bit sad, forcing ppl to upgrade to something that's not clearer, just more verbose.
Or is your plan to remove the $options argument in 8.0?

@xabbuh
Copy link
Member Author

xabbuh commented Jul 29, 2025

This change is needed to be able to throw when $options is not null in 8.0 (see https://github.com/symfony/symfony/pull/61063/files#diff-1139178a1214882355d082c476f13da20d28746a53f307571f5b5dc3571fe347L87). This PR ensures that you are aware and update your code. My ultimate goal is to deprecate the $options arguments of the different constraint classes in 8.1 (doing it earlier is probably a nightmare we cannot solve due to the fact that we cannot simply reorder arguments but also need to take named arguments into account, that will be easier once we know for sure that $options will be nothing else than null).

@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit 585e9df into symfony:7.4 Jul 29, 2025
10 of 11 checks passed
@xabbuh xabbuh deleted the validator-choices branch July 29, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy