Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 99ac309

Browse filesBrowse files
[Validator] Mention exactly option for Length constraint
1 parent c7463b2 commit 99ac309
Copy full SHA for 99ac309

File tree

Expand file treeCollapse file tree

1 file changed

+19
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-0
lines changed

‎reference/constraints/Length.rst

Copy file name to clipboardExpand all lines: reference/constraints/Length.rst
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,25 @@ Parameter Description
163163
``{{ value }}`` The current (invalid) value
164164
================= ============================================================
165165

166+
exactly
167+
~~~~~~~
168+
169+
**type**: ``integer``
170+
171+
This option is the exact length value. Validation will fail if
172+
the given value's length is not **exactly** equal to this value.
173+
174+
.. note::
175+
176+
This option is the one being set by default when using the Length constraint
177+
without passing any named argument to it. This means that for example,
178+
``@Assert\Length(20)`` and ``@Assert\Length(exactly=20)`` are equivalent, as
179+
well as ``#[Assert\Length(20)]`` and ``#[Assert\Length(exactly: 20)]``.
180+
181+
.. versionadded::
182+
183+
The named argument ``exactly`` was introduced in Symfony 5.2.
184+
166185
exactMessage
167186
~~~~~~~~~~~~
168187

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.