mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 23:59:51 +01:00
Change the contract of the formatters
Both `ArrayFormatter` and `StringFormatter` accept an instance of the `Translator`. Thinking about it a bit better, I realised that a formatter might not always need a `Translator`, but it will surely need a `Renderer`. Besides, the `InterpolationRenderer` needs to take translation into account, so it seems more natural to me that this is the one that will get an instance of the `Translator`, as other implementations of the `Renderer` might not even deal with translations.
This commit is contained in:
parent
fd7438f9c7
commit
644ecb5190
14 changed files with 91 additions and 121 deletions
|
|
@ -18,5 +18,5 @@ interface ArrayFormatter
|
|||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function format(Result $result, array $templates, Translator $translator): array;
|
||||
public function format(Result $result, Renderer $renderer, array $templates): array;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue