psalm icon indicating copy to clipboard operation
psalm copied to clipboard

Support proper evaluation of call_user_func v2

Open kkmuffme opened this issue 1 year ago • 2 comments

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

kkmuffme avatar Feb 23 '24 20:02 kkmuffme

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

psalm-github-bot[bot] avatar Feb 23 '24 20:02 psalm-github-bot[bot]

Will fix this once https://github.com/vimeo/psalm/pull/10745 is merged since it's partially similar/dependend

kkmuffme avatar Mar 19 '24 22:03 kkmuffme