Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CallableTooManyArguments error #8686

Open
vudaltsov opened this issue Nov 8, 2022 · 5 comments
Open

Add CallableTooManyArguments error #8686

vudaltsov opened this issue Nov 8, 2022 · 5 comments

Comments

@vudaltsov
Copy link
Contributor

See discussion in #8593 (comment).

@psalm-github-bot
Copy link

Hey @vudaltsov, can you reproduce the issue on https://psalm.dev ?

@vudaltsov
Copy link
Contributor Author

@orklah , @weirdan , any progress here?

@orklah
Copy link
Collaborator

orklah commented Nov 30, 2022

I went check for this, I think I confused something when we discussed about this. The actual issue that is now raised is [InvalidScalarArgument](https://psalm.dev/012). Would CallableTooManyArguments be helpful for you because you'd resolve the InvalidScalarArgument in the way described here #8593 (comment) and then suppress the CallableTooManyArguments that would be raised here?

Sorry for possibly obvious questions, just want to make sure what we deal with here

@kkmuffme
Copy link
Contributor

+1 from me for a CallableTooManyArguments, I think that makes sense (I created the original PR that changed the behavior to make this necessary in the first place) to have a distinct error.

Atm it's either an PossiblyInvalidArgument (https://psalm.dev/r/21831d9d20) or InvalidScalarArgument in those cases.

@vudaltsov can you create a PR for that?

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/21831d9d20
<?php

/**
 * @param callable(string, string) $arg
 * @return void
 */
function foo( $arg ) {}

/**
 * @param string $a
 * @return void
 */
function bar( $a ) {}

foo( 'bar' );
Psalm output (using commit 5370492):

INFO: UnusedParam - 7:15 - Param arg is never referenced in this method

INFO: UnusedParam - 13:15 - Param a is never referenced in this method

ERROR: PossiblyInvalidArgument - 15:6 - Argument 1 of foo expects callable(string, string), but possibly different type impure-callable(string):void provided

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

No branches or pull requests

3 participants