respect-validation/tests/unit/Message/Formatter
Alexandre Gomes Gaigalas cd96d01364 Fix message overriding bug in NestedArrayFormatter
This commit resolves an issue where validation messages would overwrite
each other when multiple validators failed on the same path or key
(e.g., within an `Each` or `Key` validator).

Changes to `NestedArrayFormatter`:
- Implemented a merge strategy: Key collisions now result in a list of
  messages instead of the last message winning.
- Improved handling of mixed key types: When both numeric and string
  keys are present (common in composite validators), numeric keys are now
  replaced by the validator's ID (e.g., `arrayType`, `equals`) to provide
  meaningful, distinct keys.
- Preserved list behavior: Purely numeric key sets are treated as lists,
  maintaining their sequence without re-keying logic.
- Refactored the class to use smaller, single-purpose methods and
  `array_reduce` for clarity.

Tests:
- Updated feature tests (`EachTest`, `AttributesTest`, etc.) to expect the
  full set of validation errors.
- Enhanced `NestedArrayFormatterTest` with scenarios for key collisions,
  mixed keys, and ID substitution.
2026-01-12 10:42:11 +00:00
..
FirstResultStringFormatterTest.php Rename Rule to Validator 2026-01-05 17:36:34 +01:00
NestedArrayFormatterTest.php Fix message overriding bug in NestedArrayFormatter 2026-01-12 10:42:11 +00:00
NestedListStringFormatterTest.php Update how we handle templates 2025-12-22 14:05:55 +01:00
OnlyFailedChildrenResultFilterTest.php Move important value objects to the root namespace 2025-12-21 11:14:47 +01:00
TemplateResolverTest.php Update how we handle templates 2025-12-22 14:05:55 +01:00