Fix new PHPStan errors by swissspidy · Pull Request #6163 · wp-cli/wp-cli · GitHub
Skip to content

Fix new PHPStan errors#6163

Merged
schlessera merged 1 commit into
mainfrom
fix/phpstan-errors
Dec 9, 2025
Merged

Fix new PHPStan errors#6163
schlessera merged 1 commit into
mainfrom
fix/phpstan-errors

Conversation

@swissspidy

Copy link
Copy Markdown
Member

Newly reported with the lastest package update.

@swissspidy swissspidy requested a review from a team as a code owner December 9, 2025 15:16
@swissspidy swissspidy added the scope:testing Related to testing label Dec 9, 2025
@gemini-code-assist

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

The pull request effectively resolves newly reported PHPStan errors by explicitly casting the return value of current_filter() to a string before using it in string manipulation functions like strpos and stripos. This change prevents potential TypeError exceptions in PHP 8.0+ environments, where current_filter() might return false when not within a filter hook. The modifications are precise and directly address the type compatibility issues, enhancing the robustness and correctness of the code.

Comment thread php/WP_CLI/Runner.php
Comment thread php/WP_CLI/Runner.php
Comment thread php/WP_CLI/Runner.php
Comment thread php/WP_CLI/Runner.php
@codecov

codecov Bot commented Dec 9, 2025

Copy link
Copy Markdown

@schlessera schlessera added this to the 3.0.0 milestone Dec 9, 2025
@schlessera schlessera merged commit 5aa3400 into main Dec 9, 2025
54 checks passed
@schlessera schlessera deleted the fix/phpstan-errors branch December 9, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants