File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/PHPStan/Rules/Comparison Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -813,6 +813,11 @@ public function testBug9142(): void
813813 ]);
814814 }
815815
816+ public function testBug4918 (): void
817+ {
818+ $ this ->analyse ([__DIR__ . '/data/bug-4918.php ' ], []);
819+ }
820+
816821 #[RequiresPhp('>= 8.1 ' )]
817822 public function testBug4061 (): void
818823 {
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug4918 ;
4+
5+ class HelloWorld
6+ {
7+ public function testThrowException (): void
8+ {
9+ $ tryCounter = 0 ;
10+
11+ try {
12+ $ this ->runCallback (static function () use (&$ tryCounter ): void {
13+ $ tryCounter ++;
14+ throw new LogicException ('Test exception ' );
15+ });
16+ } catch (LogicException $ e ) {
17+ if ($ tryCounter === 0 ) {
18+ throw new LogicException ('Should never happen ' );
19+ }
20+ }
21+ }
22+
23+ public function runCallback (callable $ callback ): void
24+ {
25+ $ callback ();
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments