@@ -21,21 +21,46 @@ public function test(?object $data): void
2121
2222 if ($ update ) {
2323 assertType ('object ' , $ data );
24+ assertType ("'baz' " , $ foo );
25+ } else {
26+ assertType ('null ' , $ data );
27+ assertType ("'bar' " , $ foo );
2428 }
29+ assertType ('object|null ' , $ data );
30+ assertType ("'bar'|'baz' " , $ foo );
2531 }
2632
27- public function testWithBooleans (?object $ data ): void
33+ /**
34+ * @param 1|2|3|10 $data
35+ */
36+ public function testWithBooleans ($ data ): void
2837 {
29- if ($ data === null ) {
38+ $ foo = 1 ;
39+ if ($ data === 1 || $ data === 2 ) {
3040 $ update = false ;
3141 $ foo = false ;
42+ } elseif ($ data === 3 ) {
43+ $ update = false ;
44+ $ foo = true ;
3245 } else {
3346 $ update = true ;
3447 $ foo = true ;
3548 }
3649
3750 if ($ update ) {
38- assertType ('object ' , $ data );
51+ assertType ('10 ' , $ data );
52+ assertType ('bool ' , $ foo );
53+ } else {
54+ assertType ('1|2|3 ' , $ data );
55+ assertType ('bool ' , $ foo );
56+ }
57+
58+ if ($ foo ) {
59+ assertType ('1|2|3|10 ' , $ data );
60+ assertType ('bool ' , $ update );
61+ } else {
62+ assertType ('1|2|3|10 ' , $ data );
63+ assertType ('bool ' , $ update );
3964 }
4065 }
4166
0 commit comments