File tree Expand file tree Collapse file tree 8 files changed +34
-0
lines changed Expand file tree Collapse file tree 8 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Options - `checkHost`_
1111 - `groups `_
1212 - `message `_
1313 - `mode `_
14+ - `normalizer `_
1415 - `payload `_
1516Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Email `
1617Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ EmailValidator `
@@ -167,6 +168,7 @@ html5
167168
168169This matches the pattern used for the `HTML5 email input element `_.
169170
171+ .. include :: /reference/constraints/_normalizer-option.rst.inc
170172.. include :: /reference/constraints/_payload-option.rst.inc
171173
172174.. _egulias/email-validator : https://packagist.org/packages/egulias/email-validator
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ IPv6 and many other combinations.
99Applies to :ref: `property or method <validation-property-target >`
1010Options - `groups `_
1111 - `message `_
12+ - `normalizer `_
1213 - `payload `_
1314 - `version `_
1415Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Ip `
@@ -96,6 +97,7 @@ Parameter Description
9697``{{ value }} `` The current (invalid) value
9798=============== ==============================================================
9899
100+ .. include :: /reference/constraints/_normalizer-option.rst.inc
99101.. include :: /reference/constraints/_payload-option.rst.inc
100102
101103version
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Options - `charset`_
1919 - `maxMessage `_
2020 - `min `_
2121 - `minMessage `_
22+ - `normalizer `_
2223 - `payload `_
2324Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Length `
2425Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ LengthValidator `
@@ -213,4 +214,5 @@ Parameter Description
213214``{{ value }} `` The current (invalid) value
214215================= ============================================================
215216
217+ .. include :: /reference/constraints/_normalizer-option.rst.inc
216218.. include :: /reference/constraints/_payload-option.rst.inc
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Applies to :ref:`property or method <validation-property-target>`
1111Options - `allowNull `_
1212 - `groups `_
1313 - `message `_
14+ - `normalizer `_
1415 - `payload `_
1516Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ NotBlank `
1617Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ NotBlankValidator `
@@ -110,4 +111,15 @@ Parameter Description
110111``{{ value }} `` The current (invalid) value
111112=============== ==============================================================
112113
114+ normalizer
115+ ~~~~~~~~~~
116+
117+ **type **: ``string `` **default **: ``null ``
118+
119+ If the given value is a ``string ``, this option can be used to normalize it while
120+ checking if it is valid. A ``callable `` must be passed.
121+
122+ For example, you may want to use :phpfunction: `trim ` to ignore leading and
123+ trailing whitespace during validation.
124+
113125.. include :: /reference/constraints/_payload-option.rst.inc
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Options - `groups`_
1010 - `match `_
1111 - `message `_
1212 - `pattern `_
13+ - `normalizer `_
1314 - `payload `_
1415Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Regex `
1516Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ RegexValidator `
@@ -287,4 +288,5 @@ does *not* match this regular expression (via the :phpfunction:`preg_match`
287288PHP function). However, if `match `_ is set to false, then validation will
288289fail if the input string *does * match this pattern.
289290
291+ .. include :: /reference/constraints/_normalizer-option.rst.inc
290292.. include :: /reference/constraints/_payload-option.rst.inc
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Options - `checkDNS`_
99 - `dnsMessage `_
1010 - `groups `_
1111 - `message `_
12+ - `normalizer `_
1213 - `payload `_
1314 - `protocols `_
1415 - `relativeProtocol `_
@@ -319,6 +320,7 @@ Parameter Description
319320 }
320321 }
321322
323+ .. include :: /reference/constraints/_normalizer-option.rst.inc
322324.. include :: /reference/constraints/_payload-option.rst.inc
323325
324326protocols
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ UUID versions can also be restricted using a whitelist.
1010Applies to :ref: `property or method <validation-property-target >`
1111Options - `groups `_
1212 - `message `_
13+ - `normalizer `_
1314 - `payload `_
1415 - `strict `_
1516 - `versions `_
@@ -98,6 +99,7 @@ Parameter Description
9899``{{ value }} `` The current (invalid) value
99100=============== ==============================================================
100101
102+ .. include :: /reference/constraints/_normalizer-option.rst.inc
101103.. include :: /reference/constraints/_payload-option.rst.inc
102104
103105strict
Original file line number Diff line number Diff line change 1+ normalizer
2+ ~~~~~~~~~~
3+
4+ ** type** : ``string`` ** default** : ``null``
5+
6+ This option allows a ``callable`` to be passed in order to normalize the given
7+ value while checking if it is valid.
8+
9+ For example, you may want to use : phpfunction:`trim` to ignore leading and
10+ trailing whitespace during validation.
You can’t perform that action at this time.
0 commit comments