File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
tests/PHPStan/Rules/Comparison Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,12 @@ public function testBug8797(): void
146146 $ this ->analyse ([__DIR__ . '/data/bug-8797.php ' ], []);
147147 }
148148
149+ public function testBug7937 (): void
150+ {
151+ $ this ->treatPhpDocTypesAsCertain = true ;
152+ $ this ->analyse ([__DIR__ . '/data/bug-7937.php ' ], []);
153+ }
154+
149155 public function dataReportAlwaysTrueInLastCondition (): iterable
150156 {
151157 yield [false , [
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug7937 ;
4+
5+ class HelloWorld
6+ {
7+ public function f (int $ a , int $ b )
8+ {
9+ if (!$ a && !$ b ) {
10+ return "" ;
11+ }
12+
13+ $ output = " " ;
14+
15+ if ($ a ) {
16+ $ output .= "$ a " ;
17+ }
18+
19+ \PHPStan \dumpType ($ a );
20+
21+ if ($ b ) {
22+ \PHPStan \dumpType ($ a );
23+
24+ if (!$ a ) {
25+ $ output .= "_ " ;
26+ }
27+ }
28+
29+ return $ output ;
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments