-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Multiple validation messages #1
[RFC] Multiple validation messages #1
Conversation
Pull Request Test Coverage Report for Build 9308577741Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
src/Support/StringHelper.php
Outdated
|
||
namespace Tempest\Support; | ||
|
||
final class StringHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think I like the idea of LanguageHelper::join
more.
I know this has been open for a while, but I like it 👍 One small remark, afterwards we can merge this :) |
Oke doke, should be all good now! |
There we go :) |
Addresses: tempestphp/tempest-framework#266
This PR introduces changes to the return type for Rules - now they can return either a string or an array of strings.
When array is returned, messages will be joined using
naturalLangJoin
on a new class - StringHelper, alternatively, this could be ajoin
method onLangHelper
- lemme know which one do you prefer.That method converts
to
When string is returned, the message won't be modified.
Some things to consider:
message
method tomessages
and only allow arrays to be returned, then join themmessage
method as is (went this route because it's the least breaking change, I don't have a strong preference)Value should
- maybe we can add that prefix in the exception itself? It'd be especially useful if we went the "messages + array" route, because adding that to the first element would be awkward