From 2c41c8b7ce0fbc4e2dd850531b88c737f1a50802 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 17 Jan 2023 21:22:58 +0100 Subject: [PATCH] [Validator] Mention `exactly` option for Length constraint --- reference/constraints/Length.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index 7baed971032..26e93359729 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -163,6 +163,25 @@ Parameter Description ``{{ value }}`` The current (invalid) value ================= ============================================================ +exactly +~~~~~~~ + +**type**: ``integer`` + +This option is the exact length value. Validation will fail if +the given value's length is not **exactly** equal to this value. + +.. note:: + + This option is the one being set by default when using the Length constraint + without passing any named argument to it. This means that for example, + ``@Assert\Length(20)`` and ``@Assert\Length(exactly=20)`` are equivalent, as + well as ``#[Assert\Length(20)]`` and ``#[Assert\Length(exactly: 20)]``. + +.. versionadded:: 5.2 + + The named argument ``exactly`` was introduced in Symfony 5.2. + exactMessage ~~~~~~~~~~~~