Namespaces, deprecated and scheduled hooks, performance,...#23
Namespaces, deprecated and scheduled hooks, performance,...#23kkmuffme wants to merge 1 commit intowp-hooks:trunkfrom
Conversation
Fix wp-hooks#17 Add full support for namespaces and use statements Fix wp-hooks#9 (replaces wp-hooks#11) Add (back/again?) deprecated hooks Restore dynamic hook name printing as it was pre <1.0.0, since the format was more useful/general - reused my code of psalm/psalm-plugin-wordpress (atm it's slightly different there bc I didn't have time to update it yet) Massively speed up processing by skipping ignored files earlier (mostly relevant for plugins) Speed up processing by skipping files that do not contain any filters/actions (mostly relevant for plugins) Restore error output to stderr instead of stdout which I previously already fix in <1.0.0 and consistently write errors to stderr everywhere Exclude fully dynamic, variable only hooks, since they only lead to false positive in tooling (aligns with psalm-plugin-wordpress) Add additional errors Use @return as param if it's the only annotated tag Various code style fix to make more aligned with WP code style
|
Thanks for the PR @kkmuffme. I'm happy for this to go in as long as the generated output is backwards-compatible, which it seems is it. I've invited you to be a maintainer of this repo as I've seen your work on PHPStan and other static analysis tools so I trust you. This means you'll be able to merge PRs, tag, publish releases, etc. Feel free to accept or ignore as you wish :) |
|
Thank you. |
|
Let me know if and when you create any Trac tickets, I can always take a look. |
|
I've completely overhauled the code now, added compatibility with newer versions of the dependencies (but kept backwards compatible) to fix tons of type issues/lack of type support in hook docs (e.g. couldn't use "non-falsy-string"), split it up to improve extendability and avoid duplicate code with psalm-plugin-wordpress (pending update too) I haven't pushed it yet, since I want to test it internally for a week in case there are some issues I missed. It now found various additional issues in the WP core hooks, see https://core.trac.wordpress.org/ticket/64911 |
Pending some more real world testing, updating the .json format to 1.1.0 (from 1.0.1 - even though it's fully backwards compatible and the only difference in json output are fixes for previously inconsistent/broken behavior, I think it makes sense to update the minor version instead of just the patch) |
Sorry for this massive PR, I initially intended to submit it separately, but then more and more changes accumulated as we used it internally and I never found the time to PR it.
Before these fixes might never get upstreamed/lost, I thought I PR most of it now at once. (the biggest code chunks added are just copies (with slight updates) of what I implemented in either psalm-plugin-wordpress or php stubs-generator packages already a long time ago)
Fix #17
Add full support for namespaces and use statements
Fix #9 (replaces #11)
Add (back/again?) deprecated hooks
Restore dynamic hook name printing as it was pre <1.0.0, since the format was more useful/general - reused my code of psalm/psalm-plugin-wordpress (atm it's slightly different there bc I didn't have time to update it yet)
Massively speed up processing by skipping ignored files earlier (mostly relevant for plugins)
Speed up processing by skipping files that do not contain any filters/actions (mostly relevant for plugins)
Restore error output to stderr instead of stdout which I previously already fix in <1.0.0 and consistently write errors to stderr everywhere
Exclude fully dynamic, variable only hooks, since they only lead to false positive in tooling (aligns with psalm-plugin-wordpress) Add additional errors
Use @return as param if it's the only annotated tag
Various code style fix to make more aligned with WP code style
Fix #22