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
false positive “Match expression does not handle remaining value: int<...>” for match (count(...)) { ...} #12790
If $a is an array for which count($a) can take a finite number of values, then PHPStan fails to detect that all cases of match (count($a)) { } are handled.
This is a regression introduced between 2.1.9 and 2.1.11
changed the title [-]false positive “Match expression does not handle remaining value: int<...>” match (count(...))[/-][+]false positive “Match expression does not handle remaining value: int<...>” for `match (count(...)) { ...}`[/+]on Mar 24, 2025
Activity
[-]false positive “Match expression does not handle remaining value: int<...>” match (count(...))[/-][+]false positive “Match expression does not handle remaining value: int<...>” for `match (count(...)) { ...}`[/+]phpstan-bot commentedon Mar 16, 2026
@claudepache After the latest push in 2.2.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.0 – 8.4 (2 errors)
Dumped type: int<1, 2>Match expression does not handle remaining value: 1PHP 7.2 – 7.4 (1 error)
Syntax error, unexpected T_DOUBLE_ARROW on line 11Fix match expression not recognizing exhaustive count() arms
phpstan-bot commentedon Mar 16, 2026
Closed via merging phpstan/phpstan-src#5228
github-actions commentedon Apr 17, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.