mirror of
https://github.com/Respect/Validation.git
synced 2026-03-18 08:09:51 +01:00
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. |
||
|---|---|---|
| .. | ||
| FirstResultStringFormatterTest.php | ||
| NestedArrayFormatterTest.php | ||
| NestedListStringFormatterTest.php | ||
| OnlyFailedChildrenResultFilterTest.php | ||
| TemplateResolverTest.php | ||