8000 [Validator] Deprecated the Size constraint · symfony/symfony@0be602d · GitHub
[go: up one dir, main page]

Skip to content

Commit 0be602d

Browse files
committed
[Validator] Deprecated the Size constraint
1 parent d661837 commit 0be602d

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

UPGRADE-2.1.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,26 @@
11361136
private $recursiveCollection;
11371137
```
11381138
1139+
* The `Size` constraint was deprecated and will be removed in Symfony 2.3. You should
1140+
use the constraints `Min` and `Max` instead.
1141+
1142+
Before:
1143+
1144+
```
1145+
/** @Assert\Size(min = 2, max = 16) */
1146+
private $numberOfCpus;
1147+
```
1148+
1149+
After:
1150+
1151+
```
1152+
/**
1153+
* @Assert\Min(2)
1154+
* @Assert\Max(16)
1155+
*/
1156+
private $numberOfCpus;
1157+
```
1158+
11391159
### Session
11401160
11411161
* Flash messages now return an array based on their type. The old method is

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ CHANGELOG
2222
recursively anymore by default. `Valid` contains a new property `deep`
2323
which enables the BC behavior.
2424
* added MinCount and MaxCount constraint
25+
* deprecated the Size constraint

src/Symfony/Component/Validator/Constraints/Size.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* @Annotation
1818
*
1919
* @api
20+
*
21+
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
2022
*/
2123
class Size extends Constraint
2224
{

src/Symfony/Component/Validator/Constraints/SizeValidator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* @author Bernhard Schussek <bschussek@gmail.com>
1919
*
2020
* @api
21+
*
22+
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
2123
*/
2224
class SizeValidator extends ConstraintValidator
2325
{

0 commit comments

Comments
 (0)
0