File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
tests/PHPStan/Rules/Operators Expand file tree Collapse file tree 2 files changed +34
-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 // lint >= 8.0
2+
3+ declare (strict_types = 1 );
4+
5+ namespace Bug9386 ;
6+
7+ trait BaseTrait {
8+ protected false |int $ _pos ;
9+
10+ public function myMethod ():bool {
11+ $ pos = $ this ->_pos ;
12+ if ($ pos === false )
13+ return false ;
14+ if (($ this instanceof BaseClass) && $ this ->length !== null )
15+ return $ pos >= $ this ->offset + $ this ->length ;
16+ return false ;
17+ }
18+ }
19+
20+ class BaseClass
21+ {
22+ use BaseTrait;
23+ protected ?int $ length = null ;
24+ protected int $ offset = 0 ;
25+ }
26+ class SecondClass
27+ {
28+ use BaseTrait;
29+ }
You can’t perform that action at this time.
0 commit comments