8000 Make the ConstraintViolationInterface & ConstraintViolationListInterf… · symfony/symfony@91bf1b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 91bf1b1

Browse files
committed
Make the ConstraintViolationInterface & ConstraintViolationListInterface stringable
1 parent a4241f3 commit 91bf1b1

File tree

6 files changed

+9
-2
lines changed

6 files changed

+9
-2
lines changed

UPGRADE-6.1.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ Validator
2929
---------
3030

3131
* Deprecate `Constraint::$errorNames`, use `Constraint::ERROR_NAMES` instead
32+
* Implementing the `ConstraintViolationInterface` or `ConstraintViolationListInterface`
33+
without implementing the `__toString()` method is deprecated

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Deprecate `Constraint::$errorNames`, use `Constraint::ERROR_NAMES` instead
8+
* Add method `__toString()` to `ConstraintViolationInterface` & `ConstraintViolationListInterface`
89

910
6.0
1011
---

src/Symfony/Component/Validator/ConstraintViolation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(string|\Stringable $message, ?string $messageTemplat
6464
}
6565

6666
/**
67-
* Converts the violation into a string for debugging purposes.
67+
* {@inheritdoc}
6868
*/
6969
public function __toString(): string
7070
{

src/Symfony/Component/Validator/ConstraintViolationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
* element is still the person, but the property path is "address.street".
3131
*
3232
* @author Bernhard Schussek <bschussek@gmail.com>
33+
*
34+
* @method string __toString() Converts the violation into a string for debugging purposes. Not implementing it is deprecated since Symfony 6.1.
3335
*/
3436
interface ConstraintViolationInterface
3537
{

src/Symfony/Component/Validator/ConstraintViolationList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function createFromMessage(string $message): self
4646
}
4747

4848
/**
49-
* Converts the violation into a string for debugging purposes.
49+
* {@inheritdoc}
5050
*/
5151
public function __toString(): string
5252
{

src/Symfony/Component/Validator/ConstraintViolationListInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
* @extends \ArrayAccess<int, ConstraintViolationInterface>
2020
* @extends \Traversable<int, ConstraintViolationInterface>
21+
*
22+
* @method string __toString() Converts the violation into a string for debugging purposes. Not implementing it is deprecated since Symfony 6.1.
2123
*/
2224
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
2325
{

0 commit comments

Comments
 (0)
0