File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1257,6 +1257,18 @@ public function testBug9573(): void
12571257 $ this ->assertNoErrors ($ errors );
12581258 }
12591259
1260+ public function testBug13978 (): void
1261+ {
1262+ $ errors = $ this ->runAnalyse (__DIR__ . '/data/bug-13978.php ' );
1263+ $ this ->assertNoErrors ($ errors );
1264+ }
1265+
1266+ public function testDiscussion13979 (): void
1267+ {
1268+ $ errors = $ this ->runAnalyse (__DIR__ . '/data/bug-13979.php ' );
1269+ $ this ->assertNoErrors ($ errors );
1270+ }
1271+
12601272 public function testBug9039 (): void
12611273 {
12621274 $ errors = $ this ->runAnalyse (__DIR__ . '/data/bug-9039.php ' );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug13978 ;
4+
5+ /**
6+ *
7+ * @param array{
8+ * key1: int
9+ * } $item
10+ *
11+ * @param-out array{
12+ * key1: int
13+ * }|array{
14+ * key2: float
15+ * } $item
16+ *
17+ */
18+ function example (array &$ item ): void
19+ {
20+ if (!empty ($ item ["key1 " ])) {
21+ $ item ['key2 ' ] = 1.00 ;
22+ unset($ item ["key1 " ]);
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug13979 ;
4+
5+ /**
6+ * @param array<string, mixed> $bar
7+ * @param-out array<string, mixed>|null $bar
8+ */
9+ function foo (array &$ bar ): void {
10+ if ($ bar === []) {
11+ $ bar = null ;
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments