File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,7 @@ private static function findTestFiles(): iterable
248248 yield __DIR__ . '/../Rules/Classes/data/bug-11591-property-tag.php ' ;
249249 yield __DIR__ . '/../Rules/Classes/data/mixin-trait-use.php ' ;
250250
251+ yield __DIR__ . '/../Rules/Variables/data/bug-13921.php ' ;
251252 yield __DIR__ . '/../Rules/Arrays/data/bug-14234.php ' ;
252253 yield __DIR__ . '/../Rules/Arrays/data/bug-11679.php ' ;
253254 yield __DIR__ . '/../Rules/Methods/data/bug-4801.php ' ;
Original file line number Diff line number Diff line change 22
33namespace Bug13921 ;
44
5+ use SimpleXMLElement ;
6+ use function PHPStan \Testing \assertType ;
7+
58/** @param list<array<?string>> $x */
69function foo (array $ x ): void {
710 var_dump ($ x [0 ]['bar ' ] ?? null );
@@ -25,3 +28,17 @@ function boo(array $x): void {
2528 var_dump ($ x [0 ]['bar ' ] ?? null );
2629 var_dump ($ x [1 ] ?? null );
2730}
31+
32+ function doBar (array $ array )
33+ {
34+ if (isset ($ array ['foo ' ])) {
35+ assertType ("mixed~null " , $ array ['foo ' ]);
36+ assertType ("non-empty-array&hasOffsetValue('foo', mixed~null) " , $ array );
37+ }
38+ }
39+
40+ /** @param list<SimpleXMLElement> $x */
41+ function sooSimpleElement (array $ x ): void {
42+ var_dump ($ x [0 ]['bar ' ] ?? null );
43+ var_dump ($ x [0 ] ?? null );
44+ }
You can’t perform that action at this time.
0 commit comments