-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Use default options in constraint docs #4144
Comments
Hey Bernhard! We show the long way because it's easier to migrate from it to using multiple options (or non-default options) when you need them. I think you outline a way that would show the short way and still the longer way. Personally, I'm kind of a +0. The short syntax looks better and saves you some keystrokes, but I'm uncertain as to how that weighs against the cons (less clarity, harder to know how to use a non-default option). What do others think? |
I like the idea of simplifying the basic usage examples. I guess that would make life easier for developers. Though we have to find a way to show how to use them with additional options. Wouldn't it be possible to write a generic chapter for that and link to it from each constraint? |
@xabbuh it would be a bit more work, but I'd rather do what Bernhard is showing - show one example with the default value and then immediately after, another example showing more options. |
Hey Ryan :) Thanks for your thoughtful response!
IMO the shorter version is more clear, as long as you don't use other options. The point to me is that right now many people don't even know that the short version exists. This should be fixed. As you said, if we show the longer version right after the short example, things should be clear to everyone. |
👍 |
I'll give it a try if nobody objects! |
… (alexmart) This PR was submitted for the 2.3 branch but it was merged into the 2.7 branch instead (closes #6597). Discussion ---------- [Validator] Add shorter examples using the default option | Q | A | ------------- | --- | Doc fix? | no | New docs? | no | Applies to | >= 2.3 | Fixed tickets | #4144 Commits ------- d3cde84 [Validator] Add shorter examples using the default option
Closing as fixed by #6597. |
Currently, the basic examples of constraints like GreaterThan don't use the short version for default options:
The proper (short) way of writing this would be:
I think the "Basic Usage" examples should be fixed in this direction. In addition, a new section "Message Customization" should be added that shows how to write the constraint when customizing the message:
The above applies for all configuration styles (annotations, PHP, XML and YAML).
The text was updated successfully, but these errors were encountered: