Skip to content

Commit db38ed7

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent 4f7beff commit db38ed7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Bug7856;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function doFoo() {
8+
$intervals = ['+1week', '+1months', '+6months', '+17months'];
9+
$periodEnd = new DateTimeImmutable('-1year');
10+
$endDate = new DateTimeImmutable('+1year');
11+
12+
do {
13+
assertType("array{'+1week', '+1months', '+6months', '+17months'}|array{0: literal-string&non-falsy-string, 1?: literal-string&non-falsy-string, 2?: '+17months'}", $intervals);
14+
$periodEnd = $periodEnd->modify(array_shift($intervals));
15+
} while (count($intervals) > 0 && $periodEnd->format('U') < $endDate);
16+
}

0 commit comments

Comments
 (0)