File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug11218 ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ class HelloWorld
8+ {
9+
10+ public function test (): void
11+ {
12+ for ($ i = 1 ; $ i <= 3 ; $ i ++) {
13+ if ($ i === 1 ) {
14+ $ test = 'value ' ;
15+ }
16+ }
17+
18+ assertType ("'value' " , $ test );
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug4090 ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ class HelloWorld
8+ {
9+
10+ /**
11+ * @param string[] $items
12+ */
13+ public function test (string $ value , array $ items ): void
14+ {
15+ if (in_array ($ value , $ items , true )) {
16+ assertType ('non-empty-array<string> ' , $ items );
17+ $ first = current ($ items );
18+ assertType ('string ' , $ first );
19+ }
20+ }
21+
22+ }
You can’t perform that action at this time.
0 commit comments