File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1268,6 +1268,7 @@ public function dataFileAsserts(): iterable
1268
1268
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-7805.php ' );
1269
1269
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-82.php ' );
1270
1270
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-4565.php ' );
1271
+ yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-8249.php ' );
1271
1272
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-3789.php ' );
1272
1273
1273
1274
if (PHP_VERSION_ID >= 80100 ) {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bug8249 ;
4
+
5
+ use function PHPStan \Testing \assertType ;
6
+
7
+ function foo (): mixed
8
+ {
9
+ return null ;
10
+ }
11
+
12
+ function () {
13
+ $ x = foo ();
14
+
15
+ if (is_int ($ x )) {
16
+ assertType ('int ' , $ x );
17
+ assertType ('true ' , is_int ($ x ));
18
+ } else {
19
+ assertType ('mixed~int ' , $ x );
20
+ assertType ('false ' , is_int ($ x ));
21
+ }
22
+ };
23
+
24
+ function () {
25
+ $ x = ['x ' => foo ()];
26
+
27
+ if (is_int ($ x ['x ' ])) {
28
+ assertType ('array{x: int} ' , $ x );
29
+ assertType ('int ' , $ x ['x ' ]);
30
+ assertType ('true ' , is_int ($ x ['x ' ]));
31
+ } else {
32
+ assertType ('array{x: mixed~int} ' , $ x );
33
+ assertType ('mixed~int ' , $ x ['x ' ]);
34
+ assertType ('false ' , is_int ($ x ['x ' ]));
35
+ }
36
+ };
You can’t perform that action at this time.
0 commit comments