Skip to content

Commit cd289bd

Browse files
staabmondrejmirtes
authored andcommitted
Regression test
1 parent 115a5f5 commit cd289bd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,10 @@ public function dataFileAsserts(): iterable
679679
yield from $this->gatherAssertTypes(__DIR__ . '/data/hash-functions-74.php');
680680
}
681681

682+
if (PHP_VERSION_ID >= 80000) {
683+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6308.php');
684+
}
685+
682686
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6500.php');
683687
}
684688

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php // lint >= 8.0
2+
3+
declare(strict_types=1);
4+
5+
namespace Bug6308;
6+
7+
use function PHPStan\Testing\assertType;
8+
9+
class BaseFinderStatic
10+
{
11+
static public function find(): false|static
12+
{
13+
return false;
14+
}
15+
}
16+
17+
final class UnionStaticStrict extends BaseFinderStatic
18+
{
19+
public function something()
20+
{
21+
assertType('Bug6308\UnionStaticStrict|false', $this->find());
22+
}
23+
}
24+
25+
class UnionStaticStrict2 extends BaseFinderStatic
26+
{
27+
public function something()
28+
{
29+
assertType('static(Bug6308\UnionStaticStrict2)|false', $this->find());
30+
}
31+
}

0 commit comments

Comments
 (0)