-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[5.7] Add missing()
method to the Cache
#26351
Conversation
missing()
method to the Cachemissing()
method to the Cache
This is a breaking change since you are adding a method to an interface which means that this can't go to 5.7. Besides I don't think this is useful enough to be added to the interface and force all implementations to implement that as the |
@X-Coder264 Hm.. Yes, you're right. This would be the breaking change, but only for those projects, who has their own implementation of the But please note, that we have two different contracts - one for the Only the I disagree with you, I think that such method is useful to avoid the negative conditions in the code. Anyways, now I'm not sure that |
It doesn't matter if you've added the method to the framework's only implementation of the contract. Adding a method to an interface is a breaking change and as such it must target the As for the method itself, I still stand by my opinion that this doesn't need to be added to the interface. Each method on the interface provides an unique feature that the implementation must provide. This method brings nothing new to the table, it's just the negation of an already existing method on the interface. Like for example the |
@X-Coder264 Makes sense. Great example, thank you. I've removed the |
PS: @X-Coder264 I was wonder if it is a strict rule for any interface not to have the opposite methods... and I've found two cases where it doesn't - the So, in general - it depends... not a strict rule to follow, I think... |
What is wrong with |
See above comment. |
The
missing()
method would be useful to avoid the negative conditions.For example, I have an array of keys. Some of them are present in cache, some not.
If I want to get only those which are not (for the further caching), I have to use
! has()
condition.