8000 [Validator] Update `Type` constraint, add `number`, `finite-float` an… · symfony/symfony-docs@458fdd5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 458fdd5

Browse files
committed
[Validator] Update Type constraint, add number, finite-float and finite-number validations
1 parent 3a54a22 commit 458fdd5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

reference/constraints/Type.rst

+9
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,14 @@ Also, you can use ``ctype_*()`` functions from corresponding
208208
Make sure that the proper :phpfunction:`locale <setlocale>` is set before
209209
using one of these.
210210

211+
Finally, you can use aggregated functions:
212+
213+
* ``number``: ``is_int || is_float && !is_nan``
214+
* ``finite-float``: ``is_float && is_finite``
215+
* ``finite-number``: ``is_int || is_float && is_finite``
216+
217+
.. versionadded:: 6.4
218+
``number``, ``finite-float`` and ``finite-number`` were introduced in Symfony 6.4.
219+
211220
.. _built-in PHP extension: https://www.php.net/book.ctype
212221
.. _a list of ctype functions: https://www.php.net/ref.ctype

0 commit comments

Comments
 (0)
0