Skip to content

Commit 4d97297

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Add missing version in versionadded [Validator] Mention `exactly` option for Length constraint
2 parents e47a0e2 + fd74bd6 commit 4d97297

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

reference/constraints/Length.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,25 @@ Parameter Description
123123
``{{ value }}`` The current (invalid) value
124124
================= ============================================================
125125

126+
exactly
127+
~~~~~~~
128+
129+
**type**: ``integer``
130+
131+
This option is the exact length value. Validation will fail if
132+
the given value's length is not **exactly** equal to this value.
133+
134+
.. note::
135+
136+
This option is the one being set by default when using the Length constraint
137+
without passing any named argument to it. This means that for example,
138+
``@Assert\Length(20)`` and ``@Assert\Length(exactly=20)`` are equivalent, as
139+
well as ``#[Assert\Length(20)]`` and ``#[Assert\Length(exactly: 20)]``.
140+
141+
.. versionadded:: 5.2
142+
143+
The named argument ``exactly`` was introduced in Symfony 5.2.
144+
126145
exactMessage
127146
~~~~~~~~~~~~
128147

0 commit comments

Comments
 (0)