-
-
Notifications
You must be signed in to change notification settings - Fork 78
Filters/ExactMatch: deprecate the getBlacklist()
and getWhitelist()
methods
#203
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
Merged
jrfnl
merged 1 commit into
master
from
feature/198-filter-deprecate-whitelist-blacklist-methods
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we replace the method with a non- abstract implementation, so downstream code won't need to implement a deprecated method?
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.
@derrabus Thanks for the feedback.
I was struggling a little with whether to do that or not, as that would mean we can no longer enforce that at least one of each of
getBlacklist/getBlockedFiles
andgetWhitelist/getAllowedFiles
is required to be implemented and making the new methodsabstract
would introduce a breaking change in a minor.Only way I can think of still safeguarding it, would be to remove all four method declarations from the
ExactMatch
class and usingmethod_exists()
checks and throwing an exception is any of these sets don't have a corresponding method, but removing the method declarations also makes it much less obvious what the class expects and would require significantly more documentation to be added to the class.Not sure it's worth the overhead for the (hopefully) short period until the 4.0 release, especially considering that based on a simple code search, there are no external classes extending the
ExactMatch
class.What do you think ?
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.
The abstract class could contain implementations of both methods calling each other, with a recursion detection. If a recursion is detected, you throw because in that case the downstream class hasn't implemented either of them.
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.
@derrabus Hmm.. feels a bit like overengineering for something which isn't a real life issue anyway - see the impact analysis (same link I posted in the underlying issue)
The PHP native
implements Serializable
vs__serialize()
conundrum also comes to mind.Based on the code in this PR, the following situations are possible for custom
Filter
classes which extendExactMatch
:abstract
methods.Impact:
Impact:
Impact: