Skip to content

Commit f6e4f87

Browse files
committed
Regression test
Ref phpstan/phpstan#1870
1 parent a6a23dc commit f6e4f87

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ public function dataFileAsserts(): iterable
497497
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-2142.php');
498498

499499
yield from $this->gatherAssertTypes(__DIR__ . '/data/math.php');
500+
501+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-1870.php');
500502
}
501503

502504
/**
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Bug1870;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
class Foo
8+
{
9+
10+
public function doFoo(): void
11+
{
12+
static $i = 0;
13+
$i++;
14+
assertType('(float|int)', $i);
15+
}
16+
17+
public function doBar(): void
18+
{
19+
static $i = 0;
20+
assertType('(float|int)', ++$i);
21+
}
22+
23+
}

0 commit comments

Comments
 (0)