-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Restrict the use of private functions or classes that are not meant to be extended #723
Comments
#633 has been merged ;-) |
I was discuss this with @GaryJones and I agree we should try and stop developers using private functions. It is pretty simple to find private functions / classes in core, as they all marked as I have generated a list of private functions and classes that can be found here. |
If anyone wants to work on this, this wouldn't be too hard a sniff to create. For the functions, it would be a case of combining the list created by @spacedmonkey with the IMO that sniff should only look at global functions marked as For the classes, it would be a case of combining the list created by @spacedmonkey with the For both sniffs, there are implementations available within the code base already which can be used as an example to guide you. |
Note: regarding the remark by @grappler about certain callbacks which shouldn't be reported: at this time, the abstract sniffs do not look at callbacks, so that is not an issue which (at this time) would need special handling. |
Open question: I also think a critical look at the function list would be a good idea. Until recently, functions like I imagine there may be some more functions like that on the list, in which case I would encourage changing their designation in the docblock in WP core, rather than forbidding their use. |
Are 'private classes' meant to be I know that we should just look at the standards but I kinda feel like core could do with some architectural changes... |
Any sniff like this would greatly benefit from tooling to create the initial lists and allow for updating the lists with ease. See #1803 |
Once #633 has been merged I will work on a list of private WordPress functions that should not be used by themes and plugins.
https://codex.wordpress.org/Category:Private_Functions
and
WP_Internal_Pointers
which is not meant to be extended.The following are exceptions that would still need to pass.
The text was updated successfully, but these errors were encountered: