diff --git a/reference/constraints/IsFalse.rst b/reference/constraints/IsFalse.rst index 5b2597d8657..63f1364024c 100644 --- a/reference/constraints/IsFalse.rst +++ b/reference/constraints/IsFalse.rst @@ -107,6 +107,8 @@ method returns **false**: // ... } +.. include:: /reference/constraints/_null-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/IsTrue.rst b/reference/constraints/IsTrue.rst index d9d53b04f82..aa172153e9f 100644 --- a/reference/constraints/IsTrue.rst +++ b/reference/constraints/IsTrue.rst @@ -111,6 +111,8 @@ Then you can validate this method with ``IsTrue`` as follows: If the ``isTokenValid()`` returns false, the validation will fail. +.. include:: /reference/constraints/_null-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 103ea9fd43c..307b7565749 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -148,6 +148,8 @@ This will check if ``emailAddress`` is an instance of ``Symfony\Component\Mime\A The feature to define multiple types in the ``type`` option was introduced in Symfony 4.4. +.. include:: /reference/constraints/_null-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/_null-values-are-valid.rst.inc b/reference/constraints/_null-values-are-valid.rst.inc new file mode 100644 index 00000000000..49b6a54faad --- /dev/null +++ b/reference/constraints/_null-values-are-valid.rst.inc @@ -0,0 +1,6 @@ +.. note:: + + As with most of the other constraints, ``null`` is + considered a valid value. This is to allow the use of optional values. + If the value is mandatory, a common solution is to combine this constraint + with :doc:`NotNull `.