Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03d356b

Browse files
committed
feature #18527 [Validator] Update Type constraint, add number, finite-float and finite-number validations (guillaume-a)
This PR was merged into the 6.4 branch. Discussion ---------- [Validator] Update `Type` constraint, add `number`, `finite-float` and `finite-number` validations Documentation for PR * symfony/symfony#50907 Related to * symfony/symfony#50782 This is my first sf-docs PR, please tell me if I did anything wrong. Thank you. Commits ------- 458fdd5 [Validator] Update `Type` constraint, add `number`, `finite-float` and `finite-number` validations
2 parents c3a449d + 458fdd5 commit 03d356b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

reference/constraints/Type.rst

Lines changed: 9 additions & 0 deletions
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)