Skip to content

Commit 0ebbd41

Browse files
committed
Regression tests
Closes phpstan/phpstan#13987 Closes phpstan/phpstan#13982
1 parent ea435a4 commit 0ebbd41

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,18 @@ public function testBug9994(): void
13261326
$this->assertSame('Parameter #2 $callback of function array_filter expects (callable(1|2|3|null): bool)|null, false given.', $errors[1]->getMessage());
13271327
}
13281328

1329+
public function testBug13987(): void
1330+
{
1331+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-13987.php');
1332+
$this->assertNoErrors($errors);
1333+
}
1334+
1335+
public function testBug13982(): void
1336+
{
1337+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-13982.php');
1338+
$this->assertNoErrors($errors);
1339+
}
1340+
13291341
#[RequiresPhp('>= 8.1')]
13301342
public function testBug10049(): void
13311343
{
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Bug13982;
4+
5+
function (): void {
6+
$v = new class {
7+
public function test2(): string {
8+
return self::test();
9+
}
10+
private static function test(): string {
11+
return 'result';
12+
}
13+
};
14+
15+
$v->test2();
16+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Bug13987;
4+
5+
return new class {
6+
public function getter(): never
7+
{
8+
throw self::failure();
9+
}
10+
11+
private static function failure(): \LogicException
12+
{
13+
return new \LogicException('Aha.');
14+
}
15+
16+
};

0 commit comments

Comments
 (0)