While the Result\Error object implements the JsonSerializable interface, the errors key is currently JSON encoded as an empty object. This PR allows the ErrorCollection object to serialize all the validation errors as JSON.
This can be quite valuable for logging and debugging, e.g. when the Result\Error is passed as context of the Monolog logger.
Checklist
[ ] Added changelog entry
[ ] Ran unit tests (Check the README for instructions)
Summary
While the
Result\Error
object implements theJsonSerializable
interface, theerrors
key is currently JSON encoded as an empty object. This PR allows theErrorCollection
object to serialize all the validation errors as JSON.This can be quite valuable for logging and debugging, e.g. when the
Result\Error
is passed as context of the Monolog logger.Checklist