Skip to content

Fix PHPStan error: align Hook_Callbacks type with WP_Hook::$callbacks - #228

Merged
swissspidy merged 1 commit into
mainfrom
claude/adoring-sagan-yqb09i
Oct 7, 2026
Merged

swissspidy merged 1 commit into
mainfrom
claude/adoring-sagan-yqb09i

Conversation

@swissspidy

@swissspidy swissspidy commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

The WordPress stubs now declare WP_Hook::$callbacks as array<int, array<non-decimal-int-string, array{function: callable, accepted_args: int}>>. Our local Hook_Callbacks alias still used string keys, so assigning it back to the property in set_filter_callbacks() failed assign.propertyType (failing run).

This PR narrows the inner key type of the alias to non-decimal-int-string to match the stub. This is a docblock-only change.

Verified locally: composer phpstan reports the error on main and none with this change. composer phpcs is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NDYX767HJCpR3xuCfhBTDm


Generated by Claude Code

Summary by CodeRabbit

  • Maintenance
    • No user-facing changes are included in this update. Existing features and workflows remain unchanged.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 15:17
@swissspidy
swissspidy requested a review from a team as a code owner October 7, 2026 15:17
@github-actions github-actions Bot added automated-pr bug command:profile-hook Related to 'profile hook' command scope:documentation Related to documentation labels Oct 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e0b8b788-c7c2-49f1-be43-a0596b5cb446
📥 Commits

Reviewing files that changed from the base of the PR and between 3ba68de and 6242e24.

📒 Files selected for processing (1)
  • src/Profiler.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The Hook_Callbacks PHPStan type now restricts callback keys from any string to non-decimal integer strings.

Changes

Callback key type

Layer / File(s) Summary
Callback key annotation
src/Profiler.php
The Hook_Callbacks type annotation changes its callback key type from string to non-decimal-int-string.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: schlessera

Merge Risk: ⚪ Minimal · up to 6242e

The type change matches the callback keys WordPress can retain, so this change presents no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: aligning the Hook_Callbacks type with WP_Hook::$callbacks to fix a PHPStan error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 3.0.1 milestone Oct 7, 2026
@swissspidy
swissspidy merged commit 3f51652 into main Oct 7, 2026
57 checks passed
@swissspidy
swissspidy deleted the claude/adoring-sagan-yqb09i branch October 7, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-pr bug command:profile-hook Related to 'profile hook' command scope:documentation Related to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants