From fb322df1dac40c890faf40652089ea653f103c14 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Mon, 11 Mar 2024 20:01:47 +0100 Subject: [PATCH] Use "ParameterStringifier" to stringify input The idea of the "ParameterStringifier" is to convert any value to a string. However, we use the "stringify" function directly when converting the input into a string. That defies the purpose of the ParameterStringifier, as it gives the "Formatter" two ways of converting a value into a string. Signed-off-by: Henrique Moody --- library/Message/Formatter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/Message/Formatter.php b/library/Message/Formatter.php index e35d1a23..747df7e2 100644 --- a/library/Message/Formatter.php +++ b/library/Message/Formatter.php @@ -11,7 +11,6 @@ namespace Respect\Validation\Message; use function call_user_func; use function preg_replace_callback; -use function Respect\Stringifier\stringify; final class Formatter { @@ -37,7 +36,7 @@ final class Formatter */ public function format(string $template, $input, array $parameters): string { - $parameters['name'] = $parameters['name'] ?? stringify($input); + $parameters['name'] = $parameters['name'] ?? $this->parameterStringifier->stringify('input', $input); return preg_replace_callback( '/{{(\w+)}}/',