forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-14394.php
More file actions
27 lines (23 loc) · 808 Bytes
/
bug-14394.php
File metadata and controls
27 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php declare(strict_types = 1);
namespace Bug14394;
class Cl {
/** @param list<mixed> $v2 */
public static function test(float $v1, array $v2): void {
if ($v1 == NAN) { echo "never reached\n"; }
if ($v1 === NAN) { echo "never reached\n"; }
if ($v2 == [NAN]) { echo "never reached\n"; }
if ($v2 === [NAN]) { echo "never reached\n"; }
}
public static function testSameVariable(): void {
$a = NAN;
if ($a == $a) { echo "never reached\n"; }
if ($a === $a) { echo "never reached\n"; }
if ([$a] == [$a]) { echo "never reached\n"; }
if ([$a] === [$a]) { echo "never reached\n"; }
}
/** @param array{NAN}|array{1} $v */
public static function testUnionArrayNotAlwaysFalse(array $v): void {
if ($v === [1]) { echo "maybe reached\n"; }
if ($v == [1]) { echo "maybe reached\n"; }
}
}