Skip to content

Commit a321a3e

Browse files
committed
Regression test
Closes phpstan/phpstan#2760
1 parent 6754df5 commit a321a3e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ public function dataFileAsserts(): iterable
513513
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5501.php');
514514
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4743.php');
515515
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5017.php');
516+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-2760.php');
516517
}
517518

518519
/**
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Bug2760;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function (): void {
8+
$boolean = false;
9+
assertType('false', $boolean);
10+
11+
$fn = function () use (&$boolean) : void {
12+
$iter = [0];
13+
14+
foreach ($iter as $_) {
15+
$boolean = true;
16+
17+
return;
18+
}
19+
};
20+
21+
$fn();
22+
23+
assertType('bool', $boolean);
24+
};

0 commit comments

Comments
 (0)