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`_
11
11
- `groups `_
12
12
- `message `_
13
13
- `mode `_
14
+ - `normalizer `_
14
15
- `payload `_
15
16
Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Email `
16
17
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ EmailValidator `
@@ -167,6 +168,7 @@ html5
167
168
168
169
This matches the pattern used for the `HTML5 email input element `_.
169
170
171
+ .. include :: /reference/constraints/_normalizer-option.rst.inc
170
172
.. include :: /reference/constraints/_payload-option.rst.inc
171
173
172
174
.. _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.
9
9
Applies to :ref: `property or method <validation-property-target >`
10
10
Options - `groups `_
11
11
- `message `_
12
+ - `normalizer `_
12
13
- `payload `_
13
14
- `version `_
14
15
Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Ip `
@@ -96,6 +97,7 @@ Parameter Description
96
97
``{{ value }} `` The current (invalid) value
97
98
=============== ==============================================================
98
99
100
+ .. include :: /reference/constraints/_normalizer-option.rst.inc
99
101
.. include :: /reference/constraints/_payload-option.rst.inc
100
102
101
103
version
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Options - `charset`_
19
19
- `maxMessage `_
20
20
- `min `_
21
21
- `minMessage `_
22
+ - `normalizer `_
22
23
- `payload `_
23
24
Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Length `
24
25
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ LengthValidator `
@@ -212,4 +213,5 @@ Parameter Description
212
213
``{{ value }} `` The current (invalid) value
213
214
================= ============================================================
214
215
216
+ .. include :: /reference/constraints/_normalizer-option.rst.inc
215
217
.. 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>`
11
11
Options - `allowNull `_
12
12
- `groups `_
13
13
- `message `_
14
+ - `normalizer `_
14
15
- `payload `_
15
16
Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ NotBlank `
16
17
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ NotBlankValidator `
@@ -110,4 +111,15 @@ Parameter Description
110
111
``{{ value }} `` The current (invalid) value
111
112
=============== ==============================================================
112
113
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
+
113
125
.. include :: /reference/constraints/_payload-option.rst.inc
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Options - `groups`_
10
10
- `match `_
11
11
- `message `_
12
12
- `pattern `_
13
+ - `normalizer `_
13
14
- `payload `_
14
15
Class :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Regex `
15
16
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ RegexValidator `
@@ -287,4 +288,5 @@ does *not* match this regular expression (via the :phpfunction:`preg_match`
287
288
PHP function). However, if `match `_ is set to false, then validation will
288
289
fail if the input string *does * match this pattern.
289
290
291
+ .. include :: /reference/constraints/_normalizer-option.rst.inc
290
292
.. include :: /reference/constraints/_payload-option.rst.inc
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Options - `checkDNS`_
9
9
- `dnsMessage `_
10
10
- `groups `_
11
11
- `message `_
12
+ - `normalizer `_
12
13
- `payload `_
13
14
- `protocols `_
14
15
- `relativeProtocol `_
@@ -319,6 +320,7 @@ Parameter Description
319
320
}
320
321
}
321
322
323
+ .. include :: /reference/constraints/_normalizer-option.rst.inc
322
324
.. include :: /reference/constraints/_payload-option.rst.inc
323
325
324
326
protocols
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ UUID versions can also be restricted using a whitelist.
10
10
Applies to :ref: `property or method <validation-property-target >`
11
11
Options - `groups `_
12
12
- `message `_
13
+ - `normalizer `_
13
14
- `payload `_
14
15
- `strict `_
15
16
- `versions `_
@@ -98,6 +99,7 @@ Parameter Description
98
99
``{{ value }} `` The current (invalid) value
99
100
=============== ==============================================================
100
101
102
+ .. include :: /reference/constraints/_normalizer-option.rst.inc
101
103
.. include :: /reference/constraints/_payload-option.rst.inc
102
104
103
105
strict
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