infer non-falsy-string in string replace functions#1661
Merged
Conversation
staabm
force-pushed
the
non-falsy-replace
branch
from
August 30, 2022 07:18
0f79dd4 to
5156705
Compare
staabm
marked this pull request as ready for review
August 30, 2022 07:26
Contributor
Author
|
I reproduced the build error locally with <?php
function foo(float $f) {
$s = (string) $f;
\PHPStan\dumpType($s); // line 5
$price = str_replace(',', '.', $s);
\PHPStan\dumpType($price); // line 7
if ($price == '0') {
$price = 0.000001;
}
}which leads to and reproduces with https://3v4l.org/6emcl will work on a fix |
staabm
force-pushed
the
non-falsy-replace
branch
from
August 30, 2022 17:39
afafe37 to
c04fc8a
Compare
Member
|
Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.