8000 Make constraint violation interfaces stringable by HypeMC · Pull Request #45484 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Make constraint violation interfaces stringable #45484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2022
Merged
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
2 changes: 2 additions & 0 deletions UPGRADE-6.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ Validator

* Deprecate `Constraint::$errorNames`, use `Constraint::ERROR_NAMES` instead
* Deprecate constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
* Implementing the `ConstraintViolationInterface` or `ConstraintViolationListInterface`
without implementing the `__toString()` method is deprecated
1 change: 1 addition & 0 deletions src/Symfony/Component/Validator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CHANGELOG

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

6.0
---
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/ConstraintViolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(string|\Stringable $message, ?string $messageTemplat
}

/**
* Converts the violation into a string for debugging purposes.
* {@inheritdoc}
*/
public function __toString(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* element is still the person, but the property path is "address.street".
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @method string __toString() Converts the violation into a string for debugging purposes. Not implementing it is deprecated since Symfony 6.1.
*/
interface ConstraintViolationInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function createFromMessage(string $message): self
}

/**
* Converts the violation into a string for debugging purposes.
* {@inheritdoc}
*/
public function __toString(): string
{
Expand Down
7EE2 2 changes: 2 additions & 0 deletions src/Symfony/Component/Validator/ConstraintViolationListInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @extends \ArrayAccess<int, ConstraintViolationInterface>
* @extends \Traversable<int, ConstraintViolationInterface>
*
* @method string __toString() Converts the violation into a string for debugging purposes. Not implementing it is deprecated since Symfony 6.1.
*/
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
{
Expand Down
0