PHP Code Quality / PHPStan fails on main right now (PHPStan is floated as phpstan/phpstan:^2.2 in the workflow, and 2.3.x tightened && narrowing):
include/colors.php:393 Comparison operation "<" between float<0.25000000000000006, max> and 0.01 is always false. (smaller.alwaysFalse)
include/colors.php:393 Result of && is always false. (booleanAnd.alwaysFalse)
Both are correct. The guard chain opens with $hsl[1] > 0.25, so the next conjunct's $hsl[1] < 0.01 can never be true — that !(...) term is always true and never affected the branch.
This is why #314 (a Composer bump) and #315 (an Actions bump) both fail the same two checks even though neither touches PHP.
Change
Drop the dead term and leave a comment explaining why. No behaviour change.
Verification
phpstan analyze with PHPStan 2.3.7 on PHP 8.4: No errors (was 2).
Equivalence check of the old and new conditions over 200,000 random HSL triples plus an exhaustive grid of threshold-adjacent values: 0 mismatches.
Summary by Sourcery
Remove the unreachable saturation condition from average-color selection to resolve PHPStan false-positive failures while preserving existing behavior.
Bug Fixes:
Remove a provably unreachable saturation guard from average-color calculation without changing behavior.
Enhancements:
Keep the color-selection condition clear and compatible with stricter PHPStan analysis by documenting the redundant check.
Summary by cubic
Fixes the PHPStan pipeline failure by removing a provably-dead saturation check in calculate_avg_color.
The guard chain already requires $hsl[1] > 0.25, so the later $hsl[1] < 0.01 term can never be true and never affected the branch. The dead term is dropped with a comment; behavior is unchanged. Verified with PHPStan 2.3.7 (no errors) and an equivalence check over 200,000 random HSL triples plus a threshold grid (0 mismatches).
Written for commit 78536ec781f58cadfac6f80720856fd3769b0ac3. Summary will update on new commits.
This change is
Confidence Score: 5/5
This PR appears safe to merge; color selection stays unchanged.
Summary
Removes a redundant condition from calculate_avg_color without changing which color it returns.
Average icon colors skip an impossible saturation check.
Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).
This pull request is currently open (not queued).
How to merge
To merge this PR, comment /aviator merge or add the mergequeue label.
See the real-time status of this PR on the
Aviator webapp.
Remove the unreachable saturation check and explain why it cannot affect the condition’s behavior.
include/colors.php L393-395
Tips and commands
Interacting with Sourcery
Trigger a new review: Comment @sourcery-ai review on the pull request.
Continue discussions: Reply directly to Sourcery's review comments.
Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with @sourcery-ai issue to create an issue from it.
Generate a pull request title: Write @sourcery-ai anywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai title on the pull request to (re-)generate the title at any time.
Generate a pull request summary: Write @sourcery-ai summary anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment @sourcery-ai summary on the pull request to
(re-)generate the summary at any time.
Generate reviewer's guide: Comment @sourcery-ai guide on the pull
request to (re-)generate the reviewer's guide at any time.
Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai review to trigger a new review!
Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.
Queue this pull request once it meets the queue conditions
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewerTIP This summary will be updated as you push new changes.
Current Aviator status
This pull request is currently open (not queued).
How to merge
To merge this PR, comment
/aviator mergeor add themergequeuelabel.