You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove redundant is_array() check flagged by PHPStan - #678
The PHPStan check has failed on main and on every pull request since 2026-10-28, including #676 and #677:
696 Call to function is_array() with array will always evaluate to true.
🪪 function.alreadyNarrowedType
ReflectionFunctionAbstract::getStaticVariables() always returns an array, so the is_array() check on its result in update_commands_data() is redundant. PHPStan reports it starting with 2.3.3. The repository has no composer.lock, so CI installs the newest PHPStan: the last green run on main used 2.3.2, and the first failing run used 2.3.3.
Changes
Drop the redundant is_array( $static ) condition in bin/Handbook_Command.php. No behavior change.
Verification
composer phpstan with PHPStan 2.3.4: 1 error on main, no errors with this change.
composer phpstan with PHPStan 2.3.2: no errors with or without this change.
PHPCS: no errors in bin/Handbook_Command.php.
Use of AI
AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: tracing the CI failure to the PHPStan update, testing the fix with both PHPStan versions, drafting the change, and reviewing it. I reviewed the reasoning and test results, and I take responsibility for the contribution.
Summary by CodeRabbit
Bug Fixes
Improved handling of command metadata when determining whether a command can be called. This is an internal reliability adjustment; no new user-facing capabilities or changes to the available commands are included in this update.
ReflectionFunctionAbstract::getStaticVariables() always returns an
array, so checking its result with is_array() is redundant. PHPStan
2.3.3 and newer report it as function.alreadyNarrowedType, which fails
the PHPStan check on main and on every pull request.
No actionable comments were generated in the recent review.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 1eb52abd-eb26-49ac-9a09-060ca5f8a727
Commits
Reviewing files that changed from the base of the PR and between 4d4fb89 and d1f4faf.
Files selected for processing: 1
bin/Handbook_Command.php
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
Walkthrough
update_commands_data() no longer checks whether the closure’s static variables are an array before checking for a callable entry.
Changes: Command data update
Layer / File(s)
Summary
Check callable entry bin/Handbook_Command.php
update_commands_data() removes the is_array() guard before checking for a callable entry.
The change addresses the static-analysis warning without altering reachable behavior.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: removing the redundant is_array() check identified by PHPStan.
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The PHPStan check has failed on
mainand on every pull request since 2026-10-28, including #676 and #677:ReflectionFunctionAbstract::getStaticVariables()always returns an array, so theis_array()check on its result inupdate_commands_data()is redundant. PHPStan reports it starting with 2.3.3. The repository has nocomposer.lock, so CI installs the newest PHPStan: the last green run onmainused 2.3.2, and the first failing run used 2.3.3.Changes
is_array( $static )condition inbin/Handbook_Command.php. No behavior change.Verification
composer phpstanwith PHPStan 2.3.4: 1 error onmain, no errors with this change.composer phpstanwith PHPStan 2.3.2: no errors with or without this change.bin/Handbook_Command.php.Use of AI
AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: tracing the CI failure to the PHPStan update, testing the fix with both PHPStan versions, drafting the change, and reviewing it. I reviewed the reasoning and test results, and I take responsibility for the contribution.
Summary by CodeRabbit