diff --git a/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php b/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php index 672a201ae1..18f50c815f 100644 --- a/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php +++ b/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php @@ -205,4 +205,9 @@ public function testBug13001(): void ]); } + public function testBug7280Comment(): void + { + $this->analyse([__DIR__ . '/data/bug-7280-comment.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Operators/data/bug-7280-comment.php b/tests/PHPStan/Rules/Operators/data/bug-7280-comment.php new file mode 100644 index 0000000000..7d194d4a03 --- /dev/null +++ b/tests/PHPStan/Rules/Operators/data/bug-7280-comment.php @@ -0,0 +1,20 @@ + $numbers + */ + $numbers = [1, 2]; + + $sum = array_reduce( + $numbers, + fn ($curr, $n) => $curr + $n, + 0 + ); + + if ($sum > 0) { + // + } +}