Skip to content

Support call_user_func_array#5286

Open
VincentLanglet wants to merge 4 commits intophpstan:2.1.xfrom
VincentLanglet:callUserFuncArray
Open

Support call_user_func_array#5286
VincentLanglet wants to merge 4 commits intophpstan:2.1.xfrom
VincentLanglet:callUserFuncArray

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Mar 23, 2026

Extracted from #5282

This copy the existing behavior of call_user_func but for call_user_func_array.

Closes phpstan/phpstan#5942
Closes phpstan/phpstan#5934

@VincentLanglet VincentLanglet requested a review from staabm March 23, 2026 22:24
@VincentLanglet VincentLanglet marked this pull request as ready for review March 23, 2026 22:24
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Comment on lines +146 to +149
$calledOnType = $scope->getType($callbackArg->value);
if (!$calledOnType->isCallable()->yes()) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the following loop might return early, we could move this 4 lines nearer to the usage in line 174 to prevent unnecessary work

Comment on lines 1131 to 1132
}
$this->analyse([__DIR__ . '/data/call-user-func-array.php'], $errors);
$this->analyse([__DIR__ . '/data/call-user-func-array-named-args.php'], $errors);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is call-user-func-array.php no longer tested in this rule?

@staabm
Copy link
Contributor

staabm commented Mar 24, 2026

issue-bot shows a new error with phpstan/phpstan#8214 .. might indicate we miss splat operator support...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants