When developing a plugin, is there a way to automatically determine the minimum version of WordPress that's required to run it? I want to make sure that the
Requires header is accurate, but manually checking every time I call a new core function is tedious and error-prone.
I'm thinking a script could figure it out easily enough:
- Scan all the files in a plugin.
- Parse out all the class instantiations and function calls based on the
new foo( [...] ),
foo::bar( [...] ),
bar( [...] ),
call_user_func( [...] ), etc syntax.
- Parse the WP source to determine when each of those classes/functions were added to WordPress, using the
- Generate a report listing each class/function and the version it was added, along with the earliest version of WordPress that includes all of the classes/functions.
I've looked around but couldn't find anything like it, and don't have the time to write it myself. Does anyone know of an existing solution?