Skip to content

Commit 5bdb306

Browse files
committed
Add regression test for #3770
Closes phpstan/phpstan#3770
1 parent c1ca2ac commit 5bdb306

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

tests/PHPStan/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRuleTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@ public function testFirstClassCallables(): void
119119
]);
120120
}
121121

122+
public function testBug3770(): void
123+
{
124+
$this->analyse([__DIR__ . '/data/bug-3770.php'], [
125+
[
126+
'Call to function array_map() on a separate line has no effect.',
127+
8,
128+
],
129+
[
130+
'Call to function array_map() on a separate line has no effect.',
131+
15,
132+
],
133+
[
134+
'Call to function array_map() on a separate line has no effect.',
135+
23,
136+
],
137+
]);
138+
}
139+
122140
public function testBug11317(): void
123141
{
124142
$this->analyse([__DIR__ . '/data/bug-11317.php'], [
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Bug3770;
4+
5+
/** @var array<int, int> $numbers */
6+
$numbers = [];
7+
8+
array_map(
9+
function ($value) {
10+
return $value;
11+
},
12+
$numbers,
13+
);
14+
15+
array_map(
16+
/** @param 1|2|3 $value */
17+
function ($value) {
18+
return $value;
19+
},
20+
$numbers,
21+
);
22+
23+
array_map(
24+
/** @param 1|2|3 $value */
25+
fn($value) => $value,
26+
$numbers,
27+
);

0 commit comments

Comments
 (0)