respect-validation/docs/04-message-placeholder-conversion.md
Henrique Moody d8cd6a30e0
Change documentation order
This allows someone who wants to learn more about Validation to have a
more linear inflow of information.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-02-04 16:11:57 +01:00

745 B

Message placeholder conversion

Messages in Validation usually have placeholders that are in between "{{" and "}}" characters. To replace those placeholders with the real parameters, we need to convert them to string.

We use the ParameterStringifier to convert those parameters into a string. Our default implementation will convert all parameters with Respect\Stringifier unless the parameter is called name and it is already a string.

It is possible to overwrite that behavior by creating a custom implementation of the ParameterStringifier and passing it to the Factory:

Factory::setDefaultInstance(
    (new Factory())->withParameterStringifier(new MyCustomStringifier())
);