Skip to content

Commit 99ac11e

Browse files
committed
Merge branch 2.1.x into 2.2.x
2 parents 2f2bd5c + 7f7758f commit 99ac11e

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,11 @@ public function testBug9142(): void
819819
]);
820820
}
821821

822+
public function testBug4918(): void
823+
{
824+
$this->analyse([__DIR__ . '/data/bug-4918.php'], []);
825+
}
826+
822827
#[RequiresPhp('>= 8.1')]
823828
public function testBug4061(): void
824829
{
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
}

0 commit comments

Comments
 (0)