Skip to content
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

Make rules extendable #44

Closed
manuelpichler opened this issue Jun 20, 2012 · 4 comments · Fixed by #806
Closed

Make rules extendable #44

manuelpichler opened this issue Jun 20, 2012 · 4 comments · Fixed by #806
Labels
Code Style Enhancement Good first issue If you want to help, this may be a good start Refactoring
Milestone

Comments

@manuelpichler
Copy link
Contributor

I would like to extend some of the rules, like UnusedLocalVariable and others without resorting to copy and paste. It would be much easier if those classes had protected methods instead of private methods. That way I can implement a specific ruleset for my projects, but still get any bug fixes or enhancements to those rules as they become available.

[Synced from PivotalTracker: 'http://www.pivotaltracker.com/story/show/9355955']

@ravage84
Copy link
Member

ravage84 commented Oct 8, 2014

👍 true.

@manuelpichler what is the reason behind the very restrictive use of the private visibility throughout phpmd?

@manuelpichler
Copy link
Contributor Author

@ravage84 it's because of pure classic, old man's, ideological OO thinking "Don't expose your privates" ;-)

@ravage84
Copy link
Member

@manuelpichler OK, but wouldn't protected suffice in almost all cases? What if somebody wants to extend some of the classes?

@ravage84 ravage84 modified the milestone: 2.3.3 Nov 7, 2015
@ravage84 ravage84 modified the milestones: 2.3.3, 2.4.2 Mar 8, 2016
@manuelpichler manuelpichler modified the milestones: 2.4.2, 2.4.3 Mar 10, 2016
@ravage84 ravage84 modified the milestones: 2.4.3, 2.4.4 Apr 25, 2016
@kylekatarnls kylekatarnls modified the milestones: 2.7.1, 2.8.1 Oct 19, 2019
@kylekatarnls kylekatarnls added the Good first issue If you want to help, this may be a good start label Oct 19, 2019
@kylekatarnls kylekatarnls modified the milestones: 2.8.1, 2.9.0 Oct 19, 2019
@kylekatarnls
Copy link
Member

protected could be the default. And as I'm browsing private rule methods, I find some duplicates like the getExceptionsList. If those methods would be in the AbstractRule, it would help to create new rules too.

But passing methods to protected would be a good start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Enhancement Good first issue If you want to help, this may be a good start Refactoring
Development

Successfully merging a pull request may close this issue.

3 participants