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 713c3cc

Browse filesBrowse files
committed
[#6030] Simplifying and showing code
1 parent df3cdef commit 713c3cc
Copy full SHA for 713c3cc

File tree

Expand file treeCollapse file tree

2 files changed

+16
-11
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-11
lines changed

‎reference/constraints/Blank.rst

Copy file name to clipboardExpand all lines: reference/constraints/Blank.rst
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Blank
22
=====
33

4-
Validates that a value is blank, defined as equal to a blank string or equal
5-
to ``null``. To force that a value strictly be equal to ``null``, see the
6-
:doc:`/reference/constraints/IsNull` constraint.
4+
Validates that a value is blank - meaning equal to an empty string or ``null``::
5+
6+
if ('' !== $value && null !== $value) {
7+
// validation will fail
8+
}
79

10+
To force that a value strictly be equal to ``null``, see the
11+
:doc:`/reference/constraints/IsNull` constraint.
812

9-
.. tip::
1013

11-
To force that a value is *not* blank, see
12-
:doc:`/reference/constraints/NotBlank`. But be careful as ``NotBlank`` is
13-
*not* strictly the opposite of ``Blank``. Emtpy array and strictly
14-
``false`` are considered blank by the ``NotBlank`` validator but not by the
15-
``Blank`` validator.
14+
To force that a value is *not* blank, see :doc:`/reference/constraints/NotBlank`.
15+
But be careful as ``NotBlank`` is *not* strictly the opposite of ``Blank``.
1616

1717
+----------------+---------------------------------------------------------------------+
1818
| Applies to | :ref:`property or method <validation-property-target>` |

‎reference/constraints/NotBlank.rst

Copy file name to clipboardExpand all lines: reference/constraints/NotBlank.rst
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
NotBlank
22
========
33

4-
Validates that a value is not blank, defined as not strictly ``false``,
5-
not equal to a blank string, not an empty array and also not equal to ``null``.
4+
Validates that a value is not blank - meaning not equal to a blank string,
5+
a blank array or ``null``::
6+
7+
if (false === $value || (empty($value) && '0' != $value)) {
8+
// validation will fail
9+
}
10+
611
To force that a value is simply not equal to ``null``, see the
712
:doc:`/reference/constraints/NotNull` constraint.
813

0 commit comments

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