Skip to content

Commit

Permalink
Add test for fixed bug #1014
Browse files Browse the repository at this point in the history
  • Loading branch information
jlherren authored and ondrejmirtes committed Oct 12, 2020
1 parent 080f1bc commit 0dfd0d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Expand Up @@ -10131,6 +10131,11 @@ public function dataBug3866(): array
return $this->gatherAssertTypes(__DIR__ . '/data/bug-3866.php');
}

public function dataBug1014(): array
{
return $this->gatherAssertTypes(__DIR__ . '/data/bug-1014.php');
}

/**
* @dataProvider dataBug2574
* @dataProvider dataBug2577
Expand Down Expand Up @@ -10205,6 +10210,7 @@ public function dataBug3866(): array
* @dataProvider dataBug2611
* @dataProvider dataBug3548
* @dataProvider dataBug3866
* @dataProvider dataBug1014
* @param string $assertType
* @param string $file
* @param mixed ...$args
Expand Down
18 changes: 18 additions & 0 deletions tests/PHPStan/Analyser/data/bug-1014.php
@@ -0,0 +1,18 @@
<?php declare(strict_types=1);

use function PHPStan\Analyser\assertType;

function bug1014(): void {
$s = rand(0, 1) ? 0 : 1;
assertType('0|1', $s);
if ($s) {
assertType('1', $s);
$s = 3;
assertType('3', $s);
} else {
assertType('0', $s);
}
assertType('0|3', $s);
if ($s === 1) {
}
}

0 comments on commit 0dfd0d0

Please sign in to comment.