Skip to content

Commit 4e8384f

Browse files
Fix
1 parent f8d1be2 commit 4e8384f

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

tests/PHPStan/Levels/data/acceptTypes-5.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"ignorable": true
186186
},
187187
{
188-
"message": "Parameter #2 $array of function implode expects array|null, int given.",
188+
"message": "Parameter #2 $array of function implode expects array, int given.",
189189
"line": 763,
190190
"ignorable": true
191191
}

tests/PHPStan/Levels/data/acceptTypes-7.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"ignorable": true
166166
},
167167
{
168-
"message": "Parameter #2 $array of function implode expects array|null, array|int|string given.",
168+
"message": "Parameter #2 $array of function implode expects array, array|int|string given.",
169169
"line": 756,
170170
"ignorable": true
171171
}

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,39 +2217,47 @@ public function testBug13065(): void
22172217

22182218
public function testBug5760(): void
22192219
{
2220+
if (PHP_VERSION_ID < 80000) {
2221+
$param1Name = '$glue';
2222+
$param2Name = '$pieces';
2223+
} else {
2224+
$param1Name = '$separator';
2225+
$param2Name = '$array';
2226+
}
2227+
22202228
$this->checkExplicitMixed = true;
22212229
$this->checkImplicitMixed = true;
22222230
$this->analyse([__DIR__ . '/data/bug-5760.php'], [
22232231
[
2224-
'Parameter #2 $pieces of function join expects array, list<int>|null given.',
2232+
sprintf('Parameter #2 %s of function join expects array, list<int>|null given.', $param2Name),
22252233
10,
22262234
],
22272235
[
2228-
'Parameter #1 $glue of function join expects array, list<int>|null given.',
2236+
sprintf('Parameter #1 %s of function join expects array, list<int>|null given.', $param1Name),
22292237
11,
22302238
],
22312239
[
2232-
'Parameter #2 $array of function implode expects array, list<int>|null given.',
2240+
sprintf('Parameter #2 %s of function implode expects array, list<int>|null given.', $param2Name),
22332241
13,
22342242
],
22352243
[
2236-
'Parameter #1 $separator of function implode expects array, list<int>|null given.',
2244+
sprintf('Parameter #1 %s of function implode expects array, list<int>|null given.', $param1Name),
22372245
14,
22382246
],
22392247
[
2240-
'Parameter #2 $pieces of function join expects array, array<string>|string given.',
2248+
sprintf('Parameter #2 %s of function join expects array, array<string>|string given.', $param2Name),
22412249
22,
22422250
],
22432251
[
2244-
'Parameter #1 $glue of function join expects array, array<string>|string given.',
2252+
sprintf('Parameter #1 %s of function join expects array, array<string>|string given.', $param1Name),
22452253
23,
22462254
],
22472255
[
2248-
'Parameter #2 $array of function implode expects array, array<string>|string given.',
2256+
sprintf('Parameter #2 %s of function implode expects array, array<string>|string given.', $param2Name),
22492257
25,
22502258
],
22512259
[
2252-
'Parameter #1 $separator of function implode expects array, array<string>|string given.',
2260+
sprintf('Parameter #1 %s of function implode expects array, array<string>|string given.', $param1Name),
22532261
26,
22542262
],
22552263
]);

0 commit comments

Comments
 (0)