8000 bug #6270 [Validator] Add warning for null and blank values for minim… · symfony/symfony-docs@90eaef6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90eaef6

Browse files
committed
bug #6270 [Validator] Add warning for null and blank values for minimum string length (theofidry)
This PR was submitted for the 2.3 branch but it was merged into the 2.7 branch instead (closes #6270). Discussion ---------- [Validator] Add warning for null and blank values for minimum string length | Q | A | | --- | --- | | Doc fix? | yes | | New docs? | no | | Applies to | 2.3+ | | Fixed tickets | symfony/symfony#16157 | Follow up of #5789. Summary of what has been said: even though the [Length#min](http://symfony.com/doc/current/reference/constraints/Length.html#min) option is well detailed and mention the case of `null` values, the introduction is still confusing: > Validates that a given string length is between some minimum and maximum value. As a result, a warning note is being added under this introduction. I've listed all the Symfony constraints. For some this `null` and `blank` values specificity has already been mentioned. I've noted the ones on which this warning does not apply, but for some I am not sure so it needs to be doubled checked. - Basic Contraints - [x] NotBlank: already done - [x] Blank: already done - [x] NotNull: already done - [x] IsNull: already done - ~~[ ] IsTrue~~ - ~~[ ] IsFalse~~ - ~~[ ] Type~~ - String Constraints¶ - ~~[ ] Email~~ - [x] Length - ~~[ ] Url~~ - ~~[ ] Regex~~ - ~~[ ] Ip~~ - ~~[ ] Uuid~~ - Number Constraints¶ - [ ] Range - Comparison Constraints¶ - ~~[ ] EqualTo~~ - ~~[ ] NotEqualTo~~ - ~~[ ] IdenticalTo~~ - ~~[ ] NotIdenticalTo~~ - [ ] LessThan: needed? How `@Assert\LessThan("-18 years")` behaves if the value is null? - [ ] LessThanOrEqual: same as `LessThan` - [ ] GreaterThan: same as `LessThan` - [ ] GreaterThanOrEqual: same as `LessThan` - Date Constraints¶ - ~~[ ] Date~~ - ~~[ ] DateTime~~ - ~~[ ] Time~~ - Collection Constraints¶ - ~~[ ] Choice~~ - ~~[ ] Collection~~ - ~~[ ] Count~~ - ~~[ ] UniqueEntity~~ - ~~[ ] Language~~ - ~~[ ] Locale~~ - ~~[ ] Country~~ - File Constraints¶ - ~~[ ] File~~ - ~~[ ] Image~~ - Financial and other Number Constraints¶ - ~~[ ] Bic~~ - ~~[ ] CardScheme~~ - ~~[ ] Currency~~ - ~~[ ] Luhn~~ - ~~[ ] Iban~~ - ~~[ ] Isbn~~ - ~~[ ] Issn~~ - Other Constraints¶ - ~~[ ] Callback~~ - ~~[ ] Expression~~ - ~~[ ] All~~ - ~~[ ] UserPassword~~ - ~~[ ] Valid~~ Commits ------- 38d44c2 [Validator] Add warning for null and blank values for minimum string length
2 parents 47e4769 + 38d44c2 commit 90eaef6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

reference/constraints/Length.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
Length
22
======
33

4-
Validates that a given string length is *between* some minimum and maximum
5-
value.
4+
Validates that a given string length is *between* some minimum and maximum value.
5+
6+
**Warning**: *null* and *blank* values are not handled by this constraint. To
7+
handle them, refers to the :doc:`/reference/constraints/Null`,
8+
:doc:`/reference/constraints/NotNull`, :doc:`/reference/constraints/Blank` and
9+
:doc:`/reference/constraints/NotBlank` constraints.
610

711
+----------------+----------------------------------------------------------------------+
812
| Applies to | :ref:`property or method <validation-property-target>` |

0 commit comments

Comments
 (0)
0