Skip to content

Commit c9db820

Browse files
committed
fix
1 parent 42c5047 commit c9db820

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-14213.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ public static function coalesce_int_range(): void
1212

1313
if (rand(0, 1)) {
1414
$x0 = rand(0, 1);
15+
}
16+
if (rand(0, 1)) {
1517
$x1 = rand(2, 3);
18+
}
19+
if (rand(0, 1)) {
1620
$x2 = rand(4, 5);
1721
}
1822

@@ -31,8 +35,14 @@ public static function coalesce_int_range_after_maybe_defined(): void
3135

3236
if (rand(0, 1)) {
3337
$maybeDefined = 10;
38+
}
39+
if (rand(0, 1)) {
3440
$x0 = rand(0, 1);
41+
}
42+
if (rand(0, 1)) {
3543
$x1 = rand(2, 3);
44+
}
45+
if (rand(0, 1)) {
3646
$x2 = rand(4, 5);
3747
}
3848

@@ -53,7 +63,11 @@ public static function coalesce_int_range_with_last_non_nullable(): void
5363

5464
if (rand(0, 1)) {
5565
$x0 = rand(0, 1);
66+
}
67+
if (rand(0, 1)) {
5668
$x1 = rand(2, 3);
69+
}
70+
if (rand(0, 1)) {
5771
$x2 = rand(4, 5);
5872
}
5973

tests/PHPStan/Rules/Variables/NullCoalesceRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,9 @@ public function testPr4372(): void
352352
$this->analyse([__DIR__ . '/data/pr-4372-null-coalesce.php'], []);
353353
}
354354

355+
public function testBug14213(): void
356+
{
357+
$this->analyse([__DIR__ . '/../../Analyser/nsrt/bug-14213.php'], []);
358+
}
359+
355360
}

0 commit comments

Comments
 (0)