Skip to content

Commit 5f035e0

Browse files
Fix NAN inferences
1 parent 5049143 commit 5f035e0

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Type/ConstantTypeHelper.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use function is_bool;
1717
use function is_float;
1818
use function is_int;
19-
use function is_nan;
2019
use function is_object;
2120
use function is_string;
2221

@@ -34,9 +33,6 @@ public static function getTypeFromValue($value): Type
3433
if (is_int($value)) {
3534
return new ConstantIntegerType($value);
3635
} elseif (is_float($value)) {
37-
if (is_nan($value)) {
38-
return new MixedType();
39-
}
4036
return new ConstantFloatType($value);
4137
} elseif (is_bool($value)) {
4238
return new ConstantBooleanType($value);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Bug13097;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
$f = -1 * INF;
8+
assertType('-INF', $f);
9+
10+
$f = 0 * INF;
11+
assertType('NAN', $f);
12+
13+
$f = 1 * INF;
14+
assertType('INF', $f);

0 commit comments

Comments
 (0)