April 26, 2019 Javier Eguiluz

The Symfony Validator component was originally based on the Java JSR-303 Bean Validation specification. While reviewing the Bean Validation 2.0 (JSR 380) specification, we found some new constraints that could be useful for Symfony applications.

That's why in Symfony 4.3 we've added four new constraints related to numbers: Positive , PositiveOrZero , Negative and NegativeOrZero . Although you could already validate that a number is positive/negative with the comparison constraints ( GreaterThan , LessThanOrEqual , etc.) these new constraints will make your code easier to read and understand: