diff --git a/CHANGELOG.md b/CHANGELOG.md index 73ea7e03..a6e05a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix objects are non-unique despite key order ([#819](https://github.com/jsonrainbow/json-schema/pull/819)) +### Changed +- Added extra breaking change to UPDATE-6.0.md regarding BaseConstraint::addError signature change ([#823](https://github.com/jsonrainbow/json-schema/pull/823) + ## [6.4.1] - 2025-04-04 ### Fixed - Fix support for 32bits PHP ([#817](https://github.com/jsonrainbow/json-schema/pull/817)) diff --git a/UPGRADE-6.0.md b/UPGRADE-6.0.md index cdaa36dd..f861ee17 100644 --- a/UPGRADE-6.0.md +++ b/UPGRADE-6.0.md @@ -24,4 +24,22 @@ Thank you for your support and contributions to the project. foreach ($validator->getErrors() as $error) { echo $error['constraint']['name']; // required } - ``` \ No newline at end of file + ``` + +## BaseConstraint::addError signature changed + +* The signature for the `BaseConstraint::AddError` method has changed. + + The `$message` parameter has been removed and replaced by the `ConstraintError` parameter. + The `ConstraintError` object encapsulates the error message along with additional information about the constraint violation. + + *Before* + ```php + public function addError(?JsonPointer $path, $message, $constraint = '', ?array $more = null) + ``` + + *After* + ```php + public function addError(ConstraintError $constraint, ?JsonPointer $path = null, array $more = []): void + ``` +