Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 24, 2025

Fixes PHPUnit CI Warning:

1) /home/runner/work/phpstan-src/phpstan-src/src/Type/Constant/ConstantFloatType.php:52
unexpected NAN value was coerced to string

Triggered by:

* PHPStan\Analyser\NodeScopeResolverTest::testFile#tests/PHPStan/Analyser/nsrt/bug-13097.php
  /home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Analyser/NodeScopeResolverTest.php:259

* PHPStan\Analyser\NodeScopeResolverTest::testFile#tests/PHPStan/Analyser/nsrt/pow.php
  /home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Analyser/NodeScopeResolverTest.php:259

OK, but there were issues!
Tests: 13365, Assertions: 80621, Warnings: 1, Deprecations: 6, Skipped: 63.

see

}

$valueStr = (string) $value;
if (is_finite($value) && !str_contains($valueStr, '.')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_finite is still required, because there is also INF, but this does not trigger the same warning

@ondrejmirtes ondrejmirtes merged commit 9adbff9 into phpstan:2.1.x Sep 24, 2025
541 of 549 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the o85 branch September 24, 2025 14:35
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