Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 22, 2023
1 parent 7eb66f6 commit 981c7ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/inherit-phpdoc-merging-template.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3266.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3269.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5086.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/assign-nested-arrays.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3276.php');
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-6856.php');
Expand Down
26 changes: 26 additions & 0 deletions tests/PHPStan/Analyser/data/bug-5086.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Bug5086;

use stdClass;
use function PHPStan\Testing\assertType;

class Foo
{

public function doFoo(): ?object
{

}

public function doBar(): void
{
/** @var stdClass $obj */
if (!($obj = $this->doFoo())) {
return;
}

assertType(stdClass::class, $obj);
}

}

0 comments on commit 981c7ba

Please sign in to comment.