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
EZP-27743: Rename Criterion abstract class to Matcher #2317
EZP-27743: Rename Criterion abstract class to Matcher #2317
Conversation
Side: We might want to backport this change to btw, so bundles can be adapted to work across 6.x/7.x/8.x (6.x will still be supported once 8.0 comes out). Wdyt @alongosz? |
Are you sure that |
Java uses |
@MarioBlazek Did you managed to hear from @pspanja if he had any thought on this? If he remembers past naming we have referred to this as? |
It is not a "matcher" since it's not matching anything. Instead, this is about defining rules for matching, so I find the name "criterion" to be fitting. Matching is really job of the search backend. Logical operator is just a special type of rule that works by combining/modifying other rules and that is already clear. As for the
So if going for a BC break, I would rather remove the interface. It will probably be a break in name only. |
I don't think that staying with only an abstract class
To fix the above, I wanted to use On a side note, we say that the Criterions "match" the Content in the comments (for example https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/API/Repository/Values/Content/Query/Criterion/LanguageCode.php#L17), so that's where I got the idea. But I agree, it's not the best of names. I probably lean towards |
Then the problem being fixed here is |
In any case, how would renaming Developers are already using |
@andrerom New classes in favor of the old ones can be backported as forward compatibility, but we cannot deprecate in |
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.
Overall, while I understand the point of changing name to avoid confusion where it comes to LogicalOperator
not extending Criterion
but implementing CriterionInterface
only, in this case I don't think it's the best course of action. Criterion
is a very good name here.
As discussed internally with @natanael89 I'd rather:
- remove
extends Criterion
fromLogicalOperator
and replace it withimplements CriterionInterface
and implement explicitly required contract, - keep
extends Criterion
on other Criterions as the name and implementations on abstract Criterion still fit, - document that
LogicalOperator
is a special kind of Criterion that does not rely on abstract Criterion but implements specific contract.
As @alongosz said, we decided to leave the current naming and focus on fixing the architecture. Therefore this PR will be closed. I will open another one with other fixes soon. |
master
This is the first in series of PRs which goal is to clean up the code related to Criterions and introduce proper sub-interfaces for Criterion Interface (one for logical operators and another one for attributes or matchers, as I propose to call them).
Quote from the JIRA ticket:
This PR takes care of the following step of this task:
After this PR is merged, I will create another one to change classes from kernel so they will use the new name instead of the deprecated class.
The full list of step that I plan to perform can be found in the related JIRA issue (EZP-27743).
Original PR: #2078 (requested to be split into smaller parts).
TODO:
$ composer fix-cs
).