Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…(vudaltsov) This PR was squashed before being merged into the 3.4 branch (closes #30736). Discussion ---------- [Validator] Fix annotation default for @count and @Length | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no| Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | is it worth mentioning? `Count` and `Length` constraints allow to pass the exact value as the constructor argument when used in code. ```php new Length(5); // is same as new Length(['min' => 5, 'max' => 5]); ``` At the same time when using them as annotations, `@Assert\Length(5)` throws `The options "" do not exist in constraint Symfony\\Component\\Validator\\Constraints\\Length` (fix for ugly exception is proposed in #30737). This happens because annotation's default value is passed as `value`. Since `Length` does not have a default option, `value` is replaced with `''`. This PR fixes this inconsistency. Commits ------- 7bfb8c1 [Validator] Fix annotation default for @count and @Length
- Loading branch information
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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