Skip to content

Commit 6981df1

Browse files
committed
Make the ConstraintViolationInterface & ConstraintViolationListInterface stringable
1 parent 632219a commit 6981df1

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

CHANGELOG.md

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

77
* Deprecate `Constraint::$errorNames`, use `Constraint::ERROR_NAMES` instead
88
* Deprecate constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
9+
* Add method `__toString()` to `ConstraintViolationInterface` & `ConstraintViolationListInterface`
910

1011
6.0
1112
---

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
{

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 <[email protected]>
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
{

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
{

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)