Skip to content

Commit c767265

Browse files
committed
add another failling test
1 parent 5d58a8f commit c767265

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,24 @@ function main3(mixed $c): void{
5757

5858
assertType("array{date: DateTime, id: 1, name: 'ruud'|'staabm'}", $c);
5959
}
60+
61+
/** @param array{date: DateTime} $c */
62+
function main4(mixed $c): void{
63+
assertType('array{date: DateTime}', $c);
64+
$c['id']=1;
65+
$c['name'] = 'staabm';
66+
assertType("array{date: DateTime, id: 1, name: 'staabm'}", $c);
67+
68+
$x = (function() use (&$c) {
69+
assertType("array{date: DateTime, id: 1, name: 'staabm'}", $c);
70+
if (rand(0,1)) {
71+
$c['name'] = 'ruud';
72+
assertType("array{date: DateTime, id: 1, name: 'ruud'}", $c);
73+
return 'y';
74+
}
75+
assertType("array{date: DateTime, id: 1, name: 'staabm'}", $c);
76+
return 'x';
77+
})();
78+
79+
assertType("array{date: DateTime, id: 1, name: 'ruud'|'staabm'}", $c);
80+
}

0 commit comments

Comments
 (0)