Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions 22 UPGRADE-8.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,18 @@ Uid
Validator
---------

* Deprecate `ConstraintValidatorInterface::initialize()` and `ConstraintValidatorInterface::validate()` in
favor of `ConstraintValidatorInterface::validateInContext()`. The `ConstraintValidator` abstract class
handles the context management when extending it. When writing tests with `ConstraintValidatorTestCase`,
use the new `validate` method to abstract the way to use the constraint validator.

| Your code | Action required
|----------------------------------------------------| ---------------
| extends `ConstraintValidator` | Nothing to do
| implements `ConstraintValidatorInterface` directly | Implement `validateInContext()`
| tests using `ConstraintValidatorTestCase` | Call `$this->validate()` instead of `$this->validator->validate()`
* Deprecate `ConstraintValidatorInterface::initialize()` and `ConstraintValidatorInterface::validate()` in
favor of `ConstraintValidatorInterface::validateInContext()`. The `ConstraintValidator` abstract class
handles the context management when extending it. When writing tests with `ConstraintValidatorTestCase`,
use the new `validate` method to abstract the way to use the constraint validator.

| Your code | Action required
|----------------------------------------------------| ---------------
| extends `ConstraintValidator` | Nothing to do
| implements `ConstraintValidatorInterface` directly | Implement `validateInContext()`
| tests using `ConstraintValidatorTestCase` | Call `$this->validate()` instead of `$this->validator->validate()`

* Implementing `ConstraintViolationListInterface` without implementing `findByCodes()` is deprecated

VarExporter
-----------
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/Validator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
8.1
---

* Add `findByCodes()` to `ConstraintViolationListInterface`
* Add clock-awareness to comparison and range validators for testable date comparisons
* Add the `Xml` constraint for validating XML content
* Add `ConstraintValidatorTestCase::validate()` to encapsulate the way to call the constraint validator
Expand Down
5 changes: 0 additions & 5 deletions 5 src/Symfony/Component/Validator/ConstraintViolationList.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ public function offsetUnset(mixed $offset): void
$this->remove($offset);
}

/**
* Creates iterator for errors with specific codes.
*
* @param string|string[] $codes The codes to find
*/
public function findByCodes(string|array $codes): static
{
$codes = (array) $codes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*
* @extends \ArrayAccess<int, ConstraintViolationInterface>
* @extends \Traversable<int, ConstraintViolationInterface>
*
* @method static findByCodes(string|string[] $codes) Returns a new instance with violations matching the given error codes. Not implementing it is deprecated since Symfony 8.1.
*/
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
{
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.