Skip to content

Namespaces, deprecated and scheduled hooks, performance,...#23

Open
kkmuffme wants to merge 1 commit intowp-hooks:trunkfrom
kkmuffme:upstream-most-fixes
Open

Namespaces, deprecated and scheduled hooks, performance,...#23
kkmuffme wants to merge 1 commit intowp-hooks:trunkfrom
kkmuffme:upstream-most-fixes

Conversation

@kkmuffme
Copy link
Collaborator

@kkmuffme kkmuffme commented Mar 8, 2026

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 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
@johnbillion
Copy link
Member

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 :)

@kkmuffme
Copy link
Collaborator Author

kkmuffme commented Mar 9, 2026

Thank you.
In that case, I'll just update the WP core hooks and include them in the PR, report all the issues that are now reported in WP trac so they get fixed eventually and create a release end of the week (since I probably won't be able to work on it before then)

@johnbillion
Copy link
Member

Let me know if and when you create any Trac tickets, I can always take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to parse files that contain namespaces and variables passed by reference Hooks of WP cron schedule events

2 participants