Skip to content

Fix PHPStan errors - #100

Merged
swissspidy merged 1 commit into
mainfrom
fix/phpstan-errors
Oct 7, 2026
Merged

swissspidy merged 1 commit into
mainfrom
fix/phpstan-errors

Conversation

@swissspidy

@swissspidy swissspidy commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Fixes the newly reported PHPStan errors from the scheduled code quality run (https://github.com/wp-cli/embed-command/actions/runs/37563667796):

src/Provider_Command.php:158  Strict comparison using !== between null and mixed will always evaluate to true.  (notIdentical.alwaysTrue)
src/Provider_Command.php:160  Strict comparison using !== between null and mixed will always evaluate to true.  (notIdentical.alwaysTrue)

wp embed provider match validated --limit-response-size / --link-type without discovery by checking each value for null several times in nested conditions, and PHPStan flagged the repeated checks. This PR checks each option once, collects the ones that were passed and builds the error message from that list. The error messages are exactly the same as before; they're covered by features/provider.feature.

🤖 Generated with Claude Code

https://claude.ai/code/session_014Q2gK8eSLNEQDwqibeyVJ6


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Error messages for discovery-only options now name the supplied options and use singular or plural wording as appropriate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Q2gK8eSLNEQDwqibeyVJ6
Copilot AI balanced review requested due to automatic review settings October 7, 2026 06:47
@swissspidy
swissspidy requested a review from a team as a code owner October 7, 2026 06:47

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: 8c60ea87-ee05-4444-9915-5f43dfcae270
📥 Commits

Reviewing files that changed from the base of the PR and between a14f218 and 4a7e610.

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

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


📝 Walkthrough

Walkthrough

When discovery is disabled and either discovery-only option is supplied, the error message now names the supplied option or options. The validation condition and error outcome are unchanged.

Changes

Discovery option wording

Layer / File(s) Summary
Build option-specific error message
src/Provider_Command.php
The error message names the supplied discovery-only options and uses singular or plural wording based on how many options were supplied. The validation condition and error outcome remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: ernilambar

Merge Risk: ⚪ Minimal · up to 4a7e6

The change adjusts the discovery-disabled error message. The supplied review context reports feature coverage for each option combination, and no material merge risk remains.

🚥 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 accurately summarizes the main change: resolving PHPStan warnings in src/Provider_Command.php.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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.

@github-actions github-actions Bot added automated-pr bug command:embed-provider-match Related to 'embed provider match' command command:embed-provider Related to 'embed provider' command labels Oct 7, 2026
@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 merged commit 10d4cd5 into main Oct 7, 2026
57 checks passed
@swissspidy
swissspidy deleted the fix/phpstan-errors branch October 7, 2026 07:04
@swissspidy swissspidy added this to the 3.0.1 milestone Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-pr bug command:embed-provider Related to 'embed provider' command command:embed-provider-match Related to 'embed provider match' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants