-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] deprecate the use of option arrays to configure validation constraints #54744
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
xabbuh
commented
Apr 26, 2024
•
edited by OskarStark
Loading
edited by OskarStark
Q | A |
---|---|
Branch? | 7.3 |
Bug fix? | no |
New feature? | no |
Deprecations? | yes |
Issues | Fix #51393 |
License | MIT |
0c07d99
to
0d1d920
Compare
1a3ee80
to
e58d5f9
Compare
…s with named arguments (xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [Validator] handle edge cases when constructing constraints with named arguments | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT spotted while working on #54744 Commits ------- 93eb8a0 handle edge cases when constructing constraints with named arguments
What a PR 👏 Quick question: don't we have deprecations expectations tests? I was not able to find tests where the new deprecations are expected. Did I miss them or is it avoided for some reason? |
3d2b9c2
to
a8ae27e
Compare
@@ -57,6 +58,7 @@ class Range extends Constraint | |||
* @param string|null $maxPropertyPath Property path to the max value | |||
* @param string[]|null $groups | |||
*/ | |||
#[HasNamedArguments] | |||
public function __construct( | |||
?array $options = null, |
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.
We do not have a way to deprecate certain arguments only in Symfony with annotations/attributes, do we?
We could use https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/#deprecated for this in theory.
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.
In theory that's possible by changing the order of the arguments, remove the type-hints and then determine the order in which arguments have been passed by inspecting the actual types. But I am afraid we won't be able to achieve that in the constraints due to the payload always accepting every type.
src/Symfony/Component/Validator/Constraints/ZeroComparisonConstraintTrait.php
Outdated
Show resolved
Hide resolved
Good job migrating all the tests. What a tedius work. |
9a659a1
to
77d7c80
Compare
src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTestCase.php
Show resolved
Hide resolved
src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php
Outdated
Show resolved
Hide resolved
f31e90d
to
2cc5dd9
Compare
2cdce7f
to
ac387a2
Compare
7e7705e
to
fda3214
Compare
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 didn't review all the files, but I focused on the most important ones. Huge job, thank you.
Congrats @xabbuh! 👏 |
…ois) This PR was merged into the 7.3 branch. Discussion ---------- [Validator] Fix constraints deprecations | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Small tweak after the recent merge when having a look at the commit 🙂 (see #54744) cc `@xabbuh` Commits ------- 89b7a2e [Validator] Fix constraints deprecations
This PR was merged into the 7.3 branch. Discussion ---------- [Validator] add missing changelog/upgrade entries | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT I forgot to add them in #54744 Commits ------- 411d56d add missing changelog/upgrade entries