File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -14,25 +14,28 @@ Class :class:`Symfony\\Component\\Validator\\Constraints\\Negative`
1414Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ LesserThanValidator `
1515========== ===================================================================
1616
17+ .. versionadded :: 4.3
18+
19+ The ``Negative `` constraint was introduced in Symfony 4.3.
20+
1721Basic Usage
1822-----------
1923
20- The following constraints ensure that:
24+ The following constraint ensure that:
2125
2226* the ``withdraw `` of a bankaccount ``TransferItem `` is a negative number (lesser than zero)
2327
2428.. configuration-block ::
2529
2630 .. code-block :: php-annotations
2731
28- // src/Entity/Freezer .php
32+ // src/Entity/TransferItem .php
2933 namespace App\Entity;
3034
3135 use Symfony\Component\Validator\Constraints as Assert;
3236
3337 class TransferItem
3438 {
35-
3639 /**
3740 * @Assert\Negative
3841 */
@@ -74,6 +77,6 @@ The following constraints ensure that:
7477 {
7578 public static function loadValidatorMetadata(ClassMetadata $metadata)
7679 {
77- $metadata->addPropertyConstraint('withdraw', new Assert\Negative;
80+ $metadata->addPropertyConstraint('withdraw', new Assert\Negative() ;
7881 }
7982 }
Original file line number Diff line number Diff line change @@ -14,10 +14,14 @@ Class :class:`Symfony\\Component\\Validator\\Constraints\\Positive`
1414Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ GreaterThanValidator `
1515========== ===================================================================
1616
17+ .. versionadded :: 4.3
18+
19+ The ``Positive `` constraint was introduced in Symfony 4.3.
20+
1721Basic Usage
1822-----------
1923
20- The following constraints ensure that:
24+ The following constraint ensure that:
2125
2226* the ``income `` of an ``Employee `` is a positive number (greater than zero)
2327
@@ -32,7 +36,6 @@ The following constraints ensure that:
3236
3337 class Employee
3438 {
35-
3639 /**
3740 * @Assert\Positive
3841 */
@@ -74,6 +77,6 @@ The following constraints ensure that:
7477 {
7578 public static function loadValidatorMetadata(ClassMetadata $metadata)
7679 {
77- $metadata->addPropertyConstraint('income', new Assert\Positive;
80+ $metadata->addPropertyConstraint('income', new Assert\Positive() ;
7881 }
7982 }
Original file line number Diff line number Diff line change @@ -15,10 +15,14 @@ Class :class:`Symfony\\Component\\Validator\\Constraints\\PositiveOrZero`
1515Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ GreaterThanOrEqualValidator `
1616========== ===================================================================
1717
18+ .. versionadded :: 4.3
19+
20+ The ``PositiveOrZero `` constraint was introduced in Symfony 4.3.
21+
1822Basic Usage
1923-----------
2024
21- The following constraints ensure that:
25+ The following constraint ensure that:
2226
2327* the number of ``siblings `` of a ``Person `` is positive or zero
2428
@@ -74,6 +78,6 @@ The following constraints ensure that:
7478 {
7579 public static function loadValidatorMetadata(ClassMetadata $metadata)
7680 {
77- $metadata->addPropertyConstraint('siblings', new Assert\PositiveOrZero);
81+ $metadata->addPropertyConstraint('siblings', new Assert\PositiveOrZero( );
7882 }
7983 }
You can’t perform that action at this time.
0 commit comments