File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -618,6 +618,7 @@ public function dataFileAsserts(): iterable
618618
619619 yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-6404.php ' );
620620 yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-6399.php ' );
621+ yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-4357.php ' );
621622 }
622623
623624 /**
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug4357 ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ class Sample {
8+ /** @var null|array<string, string> */
9+ private $ arr = null ;
10+
11+ public function test (): void {
12+ if ($ this ->arr === null ) {
13+ return ;
14+ }
15+
16+ assertType ('array<string, string> ' , $ this ->arr );
17+
18+ unset($ this ->arr ['hello ' ]);
19+
20+ assertType ('array<string, string> ' , $ this ->arr );
21+
22+ if (count ($ this ->arr ) === 0 ) {
23+ $ this ->arr = null ;
24+ }
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments