File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 66
77class HelloWorld
88{
9- public static function coalesce_int_range (): void
9+ public static function coalesce_nonsensical (): void
10+ {
11+ $ x0 = $ x1 = $ x2 = null ;
12+
13+ if (rand (0 , 1 )) {
14+ $ x0 = rand (0 , 1 );
15+ $ x1 = rand (2 , 3 );
16+ $ x2 = rand (4 , 5 );
17+ }
18+
19+ // either all 3 variables are null, or all have a int-range value
20+ $ x = (
21+ $ x0 ??
22+ $ x1 ??
23+ $ x2
24+ );
25+
26+ assertType ('int<0, 1>|null ' , $ x );
27+ }
28+
29+ public static function coalesce_int_ranges (): void
1030 {
1131 $ x0 = $ x1 = $ x2 = null ;
1232
Original file line number Diff line number Diff line change @@ -354,7 +354,12 @@ public function testPr4372(): void
354354
355355 public function testBug14213 (): void
356356 {
357- $ this ->analyse ([__DIR__ . '/../../Analyser/nsrt/bug-14213.php ' ], []);
357+ $ this ->analyse ([__DIR__ . '/../../Analyser/nsrt/bug-14213.php ' ], [
358+ [
359+ 'Variable $x1 on left side of ?? always exists and is always null. ' ,
360+ 21 ,
361+ ],
362+ ]);
358363 }
359364
360365}
You can’t perform that action at this time.
0 commit comments