Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 625cb84

Browse files
mglamanondrejmirtes
authored andcommitted
call_user_func_array support named arguments
1 parent 473c536 commit 625cb84

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

‎resources/functionMap_php80delta.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'bcdiv' => ['string', 'dividend'=>'string', 'divisor'=>'string', 'scale='=>'int'],
2626
'bcmod' => ['string', 'dividend'=>'string', 'divisor'=>'string', 'scale='=>'int'],
2727
'bcpowmod' => ['string', 'base'=>'string', 'exponent'=>'string', 'modulus'=>'string', 'scale='=>'int'],
28+
'call_user_func_array' => ['mixed', 'function'=>'callable', 'parameters'=>'array<int|string,mixed>'],
2829
'com_load_typelib' => ['bool', 'typelib_name'=>'string', 'case_insensitive='=>'true'],
2930
'count_chars' => ['array<int,int>|string', 'input'=>'string', 'mode='=>'int'],
3031
'date_add' => ['DateTime', 'object'=>'DateTime', 'interval'=>'DateInterval'],

‎tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,4 +905,19 @@ public function testBug5861(): void
905905
$this->analyse([__DIR__ . '/data/bug-5861.php'], []);
906906
}
907907

908+
public function testCallUserFuncArray(): void
909+
{
910+
if (PHP_VERSION_ID >= 80000) {
911+
$errors = [];
912+
} else {
913+
$errors = [
914+
[
915+
'Parameter #2 $parameters of function call_user_func_array expects array<int, mixed>, array<string, array<string, int>> given.',
916+
3,
917+
],
918+
];
919+
}
920+
$this->analyse([__DIR__ . '/data/call-user-func-array.php'], $errors);
921+
}
922+
908923
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
call_user_func_array('array_merge', ['foo' => ['bar' => 2]]);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /