-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Add hasViolations method to ConstraintViolationList #23493
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
[Validator] Add hasViolations method to ConstraintViolationList #23493
Conversation
a375dfb
to
1085848
Compare
1085848
to
e68c4e8
Compare
Calling the count() method will have the same result, isn't it? |
count():
Please see referenced issue, I didn't make up this DX issue |
why? it's a method, so works with autocomplete, isn't it?
where? the code does just a
I'm sure you didn't. We just know how each new public methods adds up to the maintenance burden, so we challenge changes, that's just normal. |
Yes it does via calling ->count(), but official way (according docs) is to use count($errors). That's also what could be improved - there is currently no "correct" way to do this. I will do the PR for docs if this will be merged. Also even when you call ->count(), autocomplete won't autocomplete
Ok I thought PHP needs to do that internally to get the count, turns out I was wrong, but
Gotcha, I just wish ideas were challenged inside an issue first. I didn't see any complaints there This is similar PR which seems to have big support #23471 |
#23471 is quite different: it increase performances by stopping the search for files as soon as one of them is found where here the performance improvement are only a few less instructions. |
Both are mainly DX improvements. To make code easier to type and make intent clearer. |
@symfony/deciders we need to make a decision here. Personally I'm "-0" :) |
Same. I don't really see a benefit and it'll not be part of the |
same for me |
I see. Thanks for consideration. Close the related issue as well please. |
This improves DX and performance for most common use case of the validator