-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0cd0ae
commit a8df2de
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a8df2de
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.
This is not working anymore. $errors->has() always return true when $keys is empty.
a8df2de
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.
@felipeweb11 Looking at the code, hasn't that always been the behaviour?
I'm not saying the current behaviour is correct, but just wondering how you think it changed.
a8df2de
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.
@JoostK The problem is that if I use errors- $>has () without passing any parameters, the behavior as it was before, should be returns true or false if there are errors, which is no more, even if there is no error, this method still returns true.
a8df2de
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.
shouldn't you be using
$errors->any()
?a8df2de
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.
for me without problems, now I started to use $ erros->count (), but the problem is that it commits not maintained compatibility in code, many other people who used $ errors->has() had the same problem.
a8df2de
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.
This behaviour looks correct. If you perform an assertion on the elements of something empty, the convention is normally that it passes.
a8df2de
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 believe that in any case this is wrong, since the parameter $keys is optional. It is expected that the call method $erros->has() when there is no error it returns false.
a8df2de
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.
correct me if I'm wrong:
if $keys is an empty array, the method will immediately return true.
func_get_args() in this case returns an empty array, then $errors->has() returns true.
a8df2de
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.
if this new behavior is correct, then before that alteration, he was wrong, because this method always returned false when there were no errors and when no parameter was passed.