Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix PHP8.5 Warning: "unexpected NAN value was coerced to string" #4368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ondrejmirtes merged 1 commit into phpstan:2.1.x from staabm:o85
Sep 24, 2025

Conversation

Copy link
Contributor

@staabm staabm commented Sep 24, 2025
edited
Loading

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
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
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /