@@ -322,7 +322,11 @@ public function testImplodeOnPhp74(): void
322322 if (PHP_VERSION_ID >= 80000 ) {
323323 $ errors = [
324324 [
325- 'Parameter #2 $array of function implode expects array|null, string given. ' ,
325+ 'Parameter #1 $separator of function implode expects string, array given. ' ,
326+ 8 ,
327+ ],
328+ [
329+ 'Parameter #2 $array of function implode expects array, string given. ' ,
326330 8 ,
327331 ],
328332 ];
@@ -336,7 +340,11 @@ public function testImplodeOnLessThanPhp74(): void
336340 if (PHP_VERSION_ID >= 80000 ) {
337341 $ errors = [
338342 [
339- 'Parameter #2 $array of function implode expects array|null, string given. ' ,
343+ 'Parameter #1 $separator of function implode expects string, array given. ' ,
344+ 8 ,
345+ ],
346+ [
347+ 'Parameter #2 $array of function implode expects array, string given. ' ,
340348 8 ,
341349 ],
342350 ];
@@ -356,6 +364,21 @@ public function testImplodeOnLessThanPhp74(): void
356364 $ this ->analyse ([__DIR__ . '/data/implode-74.php ' ], $ errors );
357365 }
358366
367+ #[RequiresPhp('>= 8.0 ' )]
368+ public function testImplodeNamedParameters (): void
369+ {
370+ $ this ->analyse ([__DIR__ . '/data/implode-named-parameters.php ' ], [
371+ [
372+ 'Missing parameter $separator (string) in call to function implode. ' ,
373+ 6 ,
374+ ],
375+ [
376+ 'Missing parameter $separator (string) in call to function join. ' ,
377+ 7 ,
378+ ],
379+ ]);
380+ }
381+
359382 public function testVariableIsNotNullAfterSeriesOfConditions (): void
360383 {
361384 require_once __DIR__ . '/data/variable-is-not-null-after-conditions.php ' ;
@@ -2224,6 +2247,54 @@ public function testBug3506(): void
22242247 $ this ->analyse ([__DIR__ . '/data/bug-3506.php ' ], []);
22252248 }
22262249
2250+ public function testBug5760 (): void
2251+ {
2252+ if (PHP_VERSION_ID < 80000 ) {
2253+ $ param1Name = '$glue ' ;
2254+ $ param2Name = '$pieces ' ;
2255+ } else {
2256+ $ param1Name = '$separator ' ;
2257+ $ param2Name = '$array ' ;
2258+ }
2259+
2260+ $ this ->checkExplicitMixed = true ;
2261+ $ this ->checkImplicitMixed = true ;
2262+ $ this ->analyse ([__DIR__ . '/data/bug-5760.php ' ], [
2263+ [
2264+ sprintf ('Parameter #2 %s of function join expects array, list<int>|null given. ' , $ param2Name ),
2265+ 10 ,
2266+ ],
2267+ [
2268+ sprintf ('Parameter #1 %s of function join expects array, list<int>|null given. ' , $ param1Name ),
2269+ 11 ,
2270+ ],
2271+ [
2272+ sprintf ('Parameter #2 %s of function implode expects array, list<int>|null given. ' , $ param2Name ),
2273+ 13 ,
2274+ ],
2275+ [
2276+ sprintf ('Parameter #1 %s of function implode expects array, list<int>|null given. ' , $ param1Name ),
2277+ 14 ,
2278+ ],
2279+ [
2280+ sprintf ('Parameter #2 %s of function join expects array, array<string>|string given. ' , $ param2Name ),
2281+ 22 ,
2282+ ],
2283+ [
2284+ sprintf ('Parameter #1 %s of function join expects array, array<string>|string given. ' , $ param1Name ),
2285+ 23 ,
2286+ ],
2287+ [
2288+ sprintf ('Parameter #2 %s of function implode expects array, array<string>|string given. ' , $ param2Name ),
2289+ 25 ,
2290+ ],
2291+ [
2292+ sprintf ('Parameter #1 %s of function implode expects array, array<string>|string given. ' , $ param1Name ),
2293+ 26 ,
2294+ ],
2295+ ]);
2296+ }
2297+
22272298 #[RequiresPhp('>= 8.0 ' )]
22282299 public function testBug12317 (): void
22292300 {
0 commit comments