-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Add sniffs for deprecated WP features #576
Comments
The only concern that I have is maintainability. If we can't automatically generate the list of deprecated features, then it won't end up getting maintained. Also, we'd need to discuss what version of WordPress we'd be building the list against. I guess it makes sense to use the latest version, even though some folks using the sniffs may support older versions and need to use the deprecated functions for back-compat. Something to consider is whether to use the latest stable version or trunk, though. |
This would be very useful for #578 as well. I consider that one issue with the approach that the WordPress Deprecated Checker uses is that not all functions that are deprecated in Core have been moved to the corresponding file. Additionally deprecated classes won't probably ever be moved, they stay in their own file, and get marked deprecated via Doc block. On that note, the PHP Doc Parser used by the WordPress.org developer documentation site has an understanding of what code elements are deprecated, so one could possibly use this to make this code sniff maintainable. |
I've hacked on the PHP Doc Parser before, so maybe I'll take a look at that again and see what is possible. I think that the parser portion will probably provide us the information that we need, and then some. The main issue will probably be sifting through all the info that is returned and then getting it into a format that we can use in our sniffs. As far as that goes, I wonder if we should let the list be stored in a file separate from the sniff itself, so that folks can easily switch to a different list (maybe for a different version of WordPress). |
That sounds like a great idea! |
I think related to this we should remove the deprected functions from |
Also - a good starting point would be the list currently in Theme Check: https://github.com/Otto42/theme-check/blob/master/checks/deprecated.php |
And another one to have a look at: https://github.com/Otto42/theme-check/blob/master/checks/more_deprecated.php |
We have a PR for deprecated functions in the WPTRT fork. The cool feature is that it is possible to define how many WP versions that should be supported. WPTT/WPThemeReview#77 Currently we are using |
Sounds like an interesting sniff. IMHO that sniff should probably be pulled here and added to the
I don't understand the question cause if you are using the |
Yes, I agree. Will get it ported over once it is ready.
|
Do we want to have a new sniff for checking deprecated WP functions or do we want to change |
@grappler I was thinking that there wouldn't really be much use for the minimum supported version in other function restriction sniffs, but now I'm not sure. Probably the best thing to do is to introduce a new abstract sniff that extends |
@jrfnl raised a point in ##826 (comment)
I think it would be best discussed here as the decision would would affect any future sniffs. For me |
Still outstanding from the initial list:
|
Note: to find deprecated hooks we should be looking for |
These sniffs would greatly benefit from tooling to create the initial lists and allow for updating the lists with ease. See #1803 |
Instead of finding out about a deprecated usage at runtime, we can use static analysis via PHPCS to list deprecated features. We should add sniffs for:
_deprecated_function
)_deprecated_constructor
)_deprecated_file
)_deprecated_hook
)See also https://github.com/gedex/wpdc
The text was updated successfully, but these errors were encountered: