Skip to content

Commit 1c270d8

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent 45aab28 commit 1c270d8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,9 @@ public function testBug13001(): void
205205
]);
206206
}
207207

208+
public function testBug7280Comment(): void
209+
{
210+
$this->analyse([__DIR__ . '/data/bug-7280-comment.php'], []);
211+
}
212+
208213
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Bug7280Comment;
4+
5+
function doFoo() {
6+
/**
7+
* @var array<int, int> $numbers
8+
*/
9+
$numbers = [1, 2];
10+
11+
$sum = array_reduce(
12+
$numbers,
13+
fn ($curr, $n) => $curr + $n,
14+
0
15+
);
16+
17+
if ($sum > 0) {
18+
//
19+
}
20+
}

0 commit comments

Comments
 (0)