8000 [Validator] Remove deprecated code paths · symfony/symfony@65a0e1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 65a0e1c

Browse files
[Validator] Remove deprecated code paths
1 parent 9e248b8 commit 65a0e1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+10
-644
lines changed

UPGRADE-7.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ Validator
127127
* Add methods `getConstraint()`, `getCause()` and `__toString()` to `ConstraintViolationInterface`
128128
* Add method `__toString()` to `ConstraintViolationListInterface`
129129
* Add method `disableTranslation()` to `ConstraintViolationBuilderInterface`
130+
* Remove static property `$errorNames` from all constraints, use const `ERROR_NAMES` instead
131+
* Remove `VALIDATION_MODE_LOOSE` from `Email` constraint, use `VALIDATION_MODE_HTML5` instead
132+
* Remove constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
130133

131134
VarDumper
132135
---------

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ class UniqueEntity extends Constraint
3939
public $errorPath;
4040
public $ignoreNull = true;
4141

42-
/**
43-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
44-
*/
45-
protected static $errorNames = self::ERROR_NAMES;
46-
4742
/**
4843
* @param array|string $fields The combination of fields that must contain unique values or a set of options
4944
* @param bool|array|string $ignoreNull The combination of fields that ignore null values

src/Symfony/Component/Form/Extension/Validator/Constraints/Form.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ class Form extends Constraint
2626
self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR',
2727
];
2828

29-
/**
30-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
31-
*/
32-
protected static $errorNames = self::ERROR_NAMES;
33-
3429
public function getTargets(): string|array
3530
{
3631
return self::CLASS_CONSTRAINT;

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ CHANGELOG
77
* Add methods `getConstraint()`, `getCause()` and `__toString()` to `ConstraintViolationInterface`
88
* Add method `__toString()` to `ConstraintViolationListInterface`
99
* Add method `disableTranslation()` to `ConstraintViolationBuilderInterface`
10+
* Remove static property `$errorNames` from all constraints, use const `ERROR_NAMES` instead
11+
* Remove `VALIDATION_MODE_LOOSE` from `Email` constraint, use `VALIDATION_MODE_HTML5` instead
12+
* Remove constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
1013

1114
6.4
1215
---

src/Symfony/Component/Validator/Constraint.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ abstract class Constraint
4949
*/
5050
protected const ERROR_NAMES = [];
5151

52-
/**
53-
* @deprecated since Symfony 6.1, use protected const ERROR_NAMES instead
54-
*/
55-
protected static $errorNames = [];
56-
5752
/**
5853
* Domain-specific data attached to a constraint.
5954
*
@@ -79,13 +74,7 @@ public static function getErrorName(string $errorCode): string
7974
return static::ERROR_NAMES[$errorCode];
8075
}
8176

82-
if (!isset(static::$errorNames[$errorCode])) {
83-
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
84-
}
85-
86-
trigger_deprecation('symfony/validator', '6.1', 'The "%s::$errorNames" property is deprecated, use protected const ERROR_NAMES instead.', static::class);
87-
88-
return static::$errorNames[$errorCode];
77+
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
8978
}
9079

9180
/**

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ class AtLeastOneOf extends Composite
2626
self::AT_LEAST_ONE_OF_ERROR => 'AT_LEAST_ONE_OF_ERROR',
2727
];
2828

29-
/**
30-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
31-
*/
32-
protected static $errorNames = self::ERROR_NAMES;
33-
3429
public $constraints = [];
3530
public $message = 'This value should satisfy at least one of the following constraints:';
3631
public $messageCollection = 'Each element of this collection should satisfy its own set of constraints.';

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ class Bic extends Constraint
4141
self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR',
4242
];
4343

44-
/**
45-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
46-
*/
47-
protected static $errorNames = self::ERROR_NAMES;
48-
4944
public $message = 'This is not a valid Business Identifier Code (BIC).';
5045
public $ibanMessage = 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.';
5146
public $iban;

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ class Blank extends Constraint
2828
self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR',
2929
];
3030

31-
/**
32-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
33-
*/
34-
protected static $errorNames = self::ERROR_NAMES;
35-
3631
public $message = 'This value should be blank.';
3732

3833
public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null)

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ class CardScheme extends Constraint
4646
self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR',
4747
];
4848

49-
/**
50-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
51-
*/
52-
protected static $errorNames = self::ERROR_NAMES;
53-
5449
public $message = 'Unsupported card type or invalid card number.';
5550
public $schemes;
5651

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ class Choice extends Constraint
3232
self::TOO_MANY_ERROR => 'TOO_MANY_ERROR',
3333
];
3434

35-
/**
36-
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
37-
*/
38-
protected static $errorNames = self::ERROR_NAMES;
39-
4035
public $choices;
4136
public $callback;
4237
public $multiple = false;

0 commit comments

Comments
 (0)
0