Skip to content

Commit 71126aa

Browse files
Fix NAN inferences
1 parent 5049143 commit 71126aa

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/Type/ConstantTypeHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ public static function getTypeFromValue($value): Type
3434
if (is_int($value)) {
3535
return new ConstantIntegerType($value);
3636
} elseif (is_float($value)) {
37-
if (is_nan($value)) {
38-
return new MixedType();
39-
}
4037
return new ConstantFloatType($value);
4138
} elseif (is_bool($value)) {
4239
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)