File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,29 @@ Parameter Description
123123``{{ value }} `` The current (invalid) value
124124================= ============================================================
125125
126+ ``countUnit ``
127+ ~~~~~~~~~~~~~~~~~~
128+
129+ **type **: ``string `` **default **: ``Length::COUNT_CODEPOINTS ``
130+
131+ The character count unit to use for the length check. By default :phpfunction: `mb_strlen `
132+ is used, which counts Unicode code points.
133+
134+ Can be one of the following constants of the
135+ :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Length ` class:
136+
137+ * ``COUNT_BYTES ``: Uses :phpfunction: `strlen ` counting the length of the string in bytes.
138+ * ``COUNT_CODEPOINTS ``: Uses :phpfunction: `mb_strlen ` counting the length of the string in Unicode
139+ code points. This was the sole behavior until Symfony 6.2 and is the default since Symfony 6.3.
140+ Simple (multibyte) Unicode characters count as 1 character, while for example ZWJ sequences of
141+ composed emojis count as multiple characters.
142+ * ``COUNT_GRAPHEMES ``: Uses :phpfunction: `grapheme_strlen ` counting the length of the string in
143+ graphemes, i.e. even emojis and ZWJ sequences of composed emojis count as 1 character.
144+
145+ .. versionadded :: 6.3
146+
147+ The ``countUnit `` option was introduced in Symfony 6.3.
148+
126149``exactly ``
127150~~~~~~~~~~~
128151
You can’t perform that action at this time.
0 commit comments