Skip to content

Expect float ranges from Assert::integerish() with PHPStan 2.3.6 - #236

Merged
ondrejmirtes merged 1 commit into
2.0.xfrom
integerish-float-range
Nov 5, 2026
Merged

ondrejmirtes merged 1 commit into
2.0.xfrom
integerish-float-range

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

With PHPStan 2.3.6 (phpstan/phpstan-src#6937), Assert::integerish() narrows floats to float<-9.223372036854776E+18, 9.223372036854776E+18>. That drops INF, -INF and NAN, which really fail $value != (int) $value, so the new types are correct and more precise.

Bumps phpstan/phpstan to ^2.3.6 and updates the expectations in type.php.

The remaining failure in comparison.php:82 (non-empty-string|numeric-string instead of non-empty-string) is a union normalization gap in phpstan-src and will be fixed there.

Floats loosely equal to an int cast are now narrowed to the int range,
which leaves out INF, -INF and NAN.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1ad71-9d5a-7120-9844-bfb0954d122f
@ondrejmirtes
ondrejmirtes merged commit 096bc11 into 2.0.x Nov 5, 2026
33 of 49 checks passed
@ondrejmirtes
ondrejmirtes deleted the integerish-float-range branch November 5, 2026 21:27
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.

1 participant