psalm
psalm copied to clipboard
Support proper evaluation of call_user_func v2
https://github.com/vimeo/psalm/issues/726 was closed with it being implemented, however it only works with non-named functions and isn't implemented for most cases at all.
https://psalm.dev/r/196d11643d
I found these snippets:
https://psalm.dev/r/196d11643d
<?php
function foo(string $a) : void {}
foo(18, 4);
call_user_func( 'foo', 18, 4);
Psalm output (using commit c488d40):
ERROR: InvalidScalarArgument - 5:5 - Argument 1 of foo expects string, but 18 provided
ERROR: TooManyArguments - 5:1 - Too many arguments for foo - expecting 1 but saw 2
Will fix this once https://github.com/vimeo/psalm/pull/10745 is merged since it's partially similar/dependend