Open romaninsh opened 7 years ago
You can override the method in your own subclass, or you can provide a callback with each assertion.
But it would probably be better to provide your own Exception class that will generate an appropriate message based upon the exception code.
This wouldn't work with default messages though:
https://github.com/beberlei/assert/blob/master/lib/Assert/Assertion.php#L2543
$message = \sprintf(static::generateMessage($message) ?: 'Value "%s" expected to be a defined constant.', $constant);
while something like this would work:
$message = \sprintf(static::generateMessage($message ?: 'Value "%s" expected to be a defined constant.'), $constant);
any ideas?
Just curious, what is the best way to localize this method:
https://github.com/beberlei/assert/blob/master/lib/Assert/Assertion.php#L2558