Valinor/tests/Unit
Romain Canon ad1207153e feat!: rework messages body and parameters features
The `\CuyZ\Valinor\Mapper\Tree\Message\Message` interface is no longer
a `Stringable`, however it defines a new method `body` that must return
the body of the message, which can contain placeholders that will be
replaced by parameters.

These parameters can now be defined by implementing the interface
`\CuyZ\Valinor\Mapper\Tree\Message\HasParameters`.

This leads to the deprecation of the no longer needed interface
`\CuyZ\Valinor\Mapper\Tree\Message\TranslatableMessage` which had a
confusing name.

```php
final class SomeException
    extends DomainException
    implements ErrorMessage, HasParameters, HasCode
{
    private string $someParameter;

    public function __construct(string $someParameter)
    {
        parent::__construct();

        $this->someParameter = $someParameter;
    }

    public function body() : string
    {
        return 'Some message / {some_parameter} / {source_value}';
    }

    public function parameters(): array
    {
        return [
            'some_parameter' => $this->someParameter,
        ];
    }

    public function code() : string
    {
        // A unique code that can help to identify the error
        return 'some_unique_code';
    }
}
```
2022-07-25 22:05:31 +02:00
..
Cache feat: extract file watching feature in own cache implementation 2022-05-23 20:28:02 +02:00
Definition test: use FakeReflector instead of anonymous class 2022-07-25 22:05:31 +02:00
Mapper feat!: rework messages body and parameters features 2022-07-25 22:05:31 +02:00
Type misc: remove types stringable behavior 2022-07-13 21:44:07 +02:00
Utility feat!: rework messages body and parameters features 2022-07-25 22:05:31 +02:00
MapperBuilderTest.php feat!: filter userland exceptions to hide potential sensible data 2022-07-08 13:58:48 +02:00