mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
I've noticed that the `StandardFormatter` was quite bloated, which made it difficult to maintain. Understanding what each method was doing was quite complicated. Besides, the name "Standard" doesn't mean anything, because it doesn't say what the implementation does. I split the `Formatter` into two different interfaces: `StringFormatter` and `ArrayFormatter`, and I moved some code around: * `StandardFormatter::main()` -> `FirstResultStringFormatter` * `StandardFormatter::full()` -> `NestedListStringFormatter` * `StandardFormatter::array()` -> `NestedArrayFormatter` That opens up new ways of handling error messages, potentially introducing features like `JsonStringFormatter` or `FlatArrayFormatter` in the future. While working on this, I removed a significant amount of unnecessary code, which also improved my overall understanding of those formatters. I'm not very happy with all the methods in `ValidatorDefaults`, but I will refactor that later.
15 lines
245 B
PHP
15 lines
245 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation;
|
|
|
|
interface ResultFilter
|
|
{
|
|
public function filter(Result $result): Result;
|
|
}
|