Skip to content

Commit

Permalink
Drop wrong comparison using PHP_FLOAT_EPSILON
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Sep 23, 2024
1 parent b40a1f6 commit a376058
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Type/Php/FilterFunctionReturnTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use function octdec;
use function preg_match;
use function sprintf;
use const PHP_FLOAT_EPSILON;

final class FilterFunctionReturnTypeHelper
{
Expand Down Expand Up @@ -293,7 +292,7 @@ private function determineExactType(Type $in, int $filterValue, Type $defaultTyp
}

if ($in instanceof ConstantFloatType) {
return $in->getValue() - (int) $in->getValue() <= PHP_FLOAT_EPSILON
return $in->getValue() - (int) $in->getValue() === 0.0
? $in->toInteger()
: $defaultType;
}
Expand Down

0 comments on commit a376058

Please sign in to comment.