#316

fix(colors): drop provably-dead saturation guard in calculate_avg_color

Opencreao-agent[bot]wants to merge intofrom

Why

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.

Reviews (1) · Last reviewed commit: "fix(colors): drop provably-dead saturati..." · Reviewed by Greptile

Activity

10
aviator-app[bot]19h ago

Current Aviator status

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.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.
sourcery-ai[bot]19h ago

Reviewer's Guide

Implementation

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!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

netlify[bot]19h ago

✅ Deploy Preview for feeddony ready!

NameLink
🔨 Latest commit78536ec781f58cadfac6f80720856fd3769b0ac3
🔍 Latest deploy loghttps://app.netlify.com/projects/feeddony/deploys/6b01930c3ce6051785aacc0c
😎 Deploy Previewhttps://deploy-preview-316--feeddony.netlify.app
📱 Preview on mobile
Toggle QR Code...



Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

coderabbitai[bot]19h ago

IMPORTANT

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: a77611ce-8c29-42e9-8a88-527889314d53

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · 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

snyk-io[bot]19h ago

:white_check_mark: Snyk checks have passed. No issues have been found so far.

StatusScan Engine Critical High Medium LowTotal (0)
:white_check_mark:Open Source Security0000 0 issues

:computer: Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

mergify[bot]19h ago

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
sourcery-ai[bot]approved changes19h ago
sourcery-ai[bot]19h ago

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
codacy-production[bot]19h ago

Up to standards :white_check_mark:

🟢 Issues 0 issues

Results: 0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

MetricResults
Complexity0
Duplication0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer TIP This summary will be updated as you push new changes.