Skip to content

Commit 784b42b

Browse files
phpstan-botclaude
andcommitted
Fix call_user_func parameter name for PHP 7.4 compatibility
The first parameter of call_user_func is named $function in PHP 7.x but was renamed to $callback in PHP 8.0+. Use PHP_VERSION_ID to select the correct name in the test assertion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3e442f2 commit 784b42b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2819,9 +2819,10 @@ public function testBug14312b(): void
28192819

28202820
public function testBug4608(): void
28212821
{
2822+
$paramName = PHP_VERSION_ID >= 80000 ? 'callback' : 'function';
28222823
$this->analyse([__DIR__ . '/data/bug-4608-call-user-func.php'], [
28232824
[
2824-
"Parameter #1 \$callback of function call_user_func expects callable(): mixed, array{class@anonymous/tests/PHPStan/Rules/Functions/data/bug-4608-call-user-func.php:5, 'abc'|'not_abc'} given.",
2825+
"Parameter #1 \${$paramName} of function call_user_func expects callable(): mixed, array{class@anonymous/tests/PHPStan/Rules/Functions/data/bug-4608-call-user-func.php:5, 'abc'|'not_abc'} given.",
28252826
11,
28262827
],
28272828
]);

0 commit comments

Comments
 (0)