Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Feb 1, 2022
1 parent 115a5f5 commit cd289bd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/hash-functions-74.php');
}

if (PHP_VERSION_ID >= 80000) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6308.php');
}

yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6500.php');
}

Expand Down
31 changes: 31 additions & 0 deletions tests/PHPStan/Analyser/data/bug-6308.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php // lint >= 8.0

declare(strict_types=1);

namespace Bug6308;

use function PHPStan\Testing\assertType;

class BaseFinderStatic
{
static public function find(): false|static
{
return false;
}
}

final class UnionStaticStrict extends BaseFinderStatic
{
public function something()
{
assertType('Bug6308\UnionStaticStrict|false', $this->find());
}
}

class UnionStaticStrict2 extends BaseFinderStatic
{
public function something()
{
assertType('static(Bug6308\UnionStaticStrict2)|false', $this->find());
}
}

0 comments on commit cd289bd

Please sign in to comment.