Skip to content

ci: ignore phpstan function.alreadyNarrowedType identifier#7208

Open
somethingwithproof wants to merge 1 commit into
Cacti:developfrom
somethingwithproof:fix/phpstan-already-narrowed-type
Open

ci: ignore phpstan function.alreadyNarrowedType identifier#7208
somethingwithproof wants to merge 1 commit into
Cacti:developfrom
somethingwithproof:fix/phpstan-already-narrowed-type

Conversation

@somethingwithproof

Copy link
Copy Markdown
Contributor

develop is failing the Cacti Commit Audit (PHP 8.1-8.4) at level 6:

lib/data_query.php:2591  Call to function is_numeric() with float|int|numeric-string
                         will always evaluate to true.  (function.alreadyNarrowedType)

.phpstan.neon already ignores the matching narrowing identifiers (if.alwaysTrue, equal.alwaysTrue, identical.alwaysTrue, the booleanAnd.* pair, etc.) under the "PHPStan gets confused" group. function.alreadyNarrowedType is the same class of complaint for built-in predicates and was the only one missing. Adding it turns the audit green.

No code behavior change.

is_numeric() on a value PHPStan already narrows to numeric (lib/data_query.php:2591)
trips alreadyNarrowedType, the same class of narrowing complaint already ignored for
the if/equal/identical identifiers above. Add it so level 6 analysis passes.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copilot AI review requested due to automatic review settings June 14, 2026 17:37

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates PHPStan configuration to suppress an additional static analysis finding.

Changes:

  • Adds function.alreadyNarrowedType to the list of ignored PHPStan error identifiers.

Comment thread .phpstan.neon
- identifier: identical.alwaysFalse
- identifier: booleanAnd.leftAlwaysTrue
- identifier: booleanAnd.leftAlwaysFalse
- identifier: function.alreadyNarrowedType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants