File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/PHPStan/Rules/Operators Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,11 @@ public function testBug13001(): void
205205 ]);
206206 }
207207
208+ public function testBug9386 (): void
209+ {
210+ $ this ->analyse ([__DIR__ . '/data/bug-9386.php ' ], []);
211+ }
212+
208213 public function testBug7280Comment (): void
209214 {
210215 $ this ->analyse ([__DIR__ . '/data/bug-7280-comment.php ' ], []);
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug9386 ;
4+
5+ trait BaseTrait {
6+ protected false |int $ _pos ;
7+
8+ public function myMethod ():bool {
9+ $ pos = $ this ->_pos ;
10+ if ($ pos === false )
11+ return false ;
12+ if (($ this instanceof BaseClass) && $ this ->length !== null )
13+ return $ pos >= $ this ->offset + $ this ->length ;
14+ return false ;
15+ }
16+ }
17+
18+ class BaseClass
19+ {
20+ use BaseTrait;
21+ protected ?int $ length = null ;
22+ protected int $ offset = 0 ;
23+ }
24+ class SecondClass
25+ {
26+ use BaseTrait;
27+ }
You can’t perform that action at this time.
0 commit comments