Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #34081 [Validator] Set Length::$allowEmptyString to false when a …
…NotBlank contraint is defined (nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [Validator] Set Length::$allowEmptyString to false when a NotBlank contraint is defined | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Since #31528, we are told to do this kind of changes to our entities: ```diff /** * @Assert\NotBlank() - * @Assert\Length(min="10") + * @Assert\Length(min="10", allowEmptyString=false) */ public $description; ``` But the `NotBlank` already says it - this is just boilerplate. More critically, this also means we cannot write annotations that are compatible with 3.4, 4.4 and 5.0 at the same time, making FC/BC hard. By setting `Length::$allowEmptyString` to `false` when a `NotBlank` contraint is defined, we fix both issues. /cc @ogizanagi Commits ------- 840f7e7 [Validator] Set Length::$allowEmptyString to false when a NotBlank contraint is defined
- Loading branch information
Showing
3 changed files
with
35 additions
and
11 deletions.
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