File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
tests/PHPStan/Rules/Comparison Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -173,4 +173,10 @@ public function testBug4912(): void
173173 $ this ->analyse ([__DIR__ . '/data/bug-4912.php ' ], []);
174174 }
175175
176+ public function testBug4864 (): void
177+ {
178+ $ this ->treatPhpDocTypesAsCertain = true ;
179+ $ this ->analyse ([__DIR__ . '/data/bug-4864.php ' ], []);
180+ }
181+
176182}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug4864 ;
4+
5+ class Example
6+ {
7+ /** @var mixed */
8+ private $ value ;
9+ private bool $ isHandled ;
10+
11+ public function fetchValue (callable $ f ): void
12+ {
13+ $ this ->isHandled = false ;
14+ $ this ->value = null ;
15+
16+ (function () {
17+ $ this ->isHandled = true ;
18+ $ this ->value = 'value ' ;
19+ })();
20+
21+ if ($ this ->isHandled ) {
22+ $ f ($ this ->value );
23+ }
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments