Skip to content

Fix PHPStan errors with WordPress 7.1 stubs - #150

Merged
swissspidy merged 1 commit into
mainfrom
fix/phpstan-wp71
Aug 29, 2026
Merged

Fix PHPStan errors with WordPress 7.1 stubs#150
swissspidy merged 1 commit into
mainfrom
fix/phpstan-wp71

Conversation

@swissspidy

@swissspidy swissspidy commented Aug 29, 2026

Copy link
Copy Markdown
Member

php-stubs/wordpress-stubs v7.1.0 tightened the types of WP core functions, which surfaced one new PHPStan error at level 9.

_get_cron_array() now has a precise return type, so the @var array<string, array<mixed>> $cron annotation in Cron_Event_Command::unschedule() was wider than the type PHPStan already infers. Removed the redundant annotation; the defensive is_array() runtime check is kept for older WordPress versions.

PHPStan is clean again with no baseline or ignore entries.


Generated by Claude Code

Summary by CodeRabbit

  • Refactor
    • Removed an internal code comment; no user-visible behavior or functionality changed.

wordpress-stubs v7.1.0 gives _get_cron_array() a precise return type,
making the @var annotation in unschedule() wider than the inferred type.
@swissspidy
swissspidy requested a review from a team as a code owner August 29, 2026 07:53
Copilot AI lite review requested due to automatic review settings August 29, 2026 07:53

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 Aug 29, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ff0c53e0-caa0-4733-b30c-3fb3d60ade14

📥 Commits

Reviewing files that changed from the base of the PR and between 8fbb92f and 3c3da20.

📒 Files selected for processing (1)
  • src/Cron_Event_Command.php
💤 Files with no reviewable changes (1)
  • src/Cron_Event_Command.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change removes an obsolete @var annotation from the unschedule method in Cron_Event_Command. No functional logic or public declarations changed.

Changes

Cohort / File(s) Summary
Cron annotation cleanup
src/Cron_Event_Command.php
Removes the loop-local PHPDoc annotation for $cron.

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

Merge Risk: ⚪ Minimal · up to 3c3da

This localized change removes a redundant type annotation while preserving the existing runtime check, with no actionable merge-blocking risk remaining beyond normal checks and review.

🚥 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 identifies the main change: removing a redundant annotation to resolve PHPStan errors with WordPress 7.1 stubs.
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 0…
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.
Full details: Docstring Coverage

Explanation

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 0 files.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/phpstan-wp71

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.

@github-actions github-actions Bot added automated-pr bug command:cron Related to 'cron' command command:cron-event Related to 'cron event' command command:cron-event-unschedule Related to 'cron event unschedule' command scope:testing Related to testing labels Aug 29, 2026
@codecov

codecov Bot commented Aug 29, 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 Aug 29, 2026
@swissspidy
swissspidy merged commit 0abccf4 into main Aug 29, 2026
57 checks passed
@swissspidy
swissspidy deleted the fix/phpstan-wp71 branch August 29, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-pr bug command:cron Related to 'cron' command command:cron-event Related to 'cron event' command command:cron-event-unschedule Related to 'cron event unschedule' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants