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

Support for named argument in callable signatures #10766

Closed
mathroc opened this issue Mar 1, 2024 · 1 comment · Fixed by #10772
Closed

Support for named argument in callable signatures #10766

mathroc opened this issue Mar 1, 2024 · 1 comment · Fixed by #10772

Comments

@mathroc
Copy link
Contributor

mathroc commented Mar 1, 2024

callable signatures can have variable names, but I think they are ignored

now that we can use named arguments at call time, it would be useful to support them

https://psalm.dev/r/96ddbe571b

Copy link

I found these snippets:

https://psalm.dev/r/96ddbe571b
<?php

/**
 * @param callable(int $i): void  $c
 */
function f(callable $c): void {
    $c('a'); // Psalm properly see that the first argument is an int 
    $c(i: 0); // But its name was forgotten
}
Psalm output (using commit b940c7e):

ERROR: InvalidArgument - 7:8 - Argument 1 expects int, but 'a' provided

ERROR: InvalidNamedArgument - 8:8 - Parameter $i does not exist on function 

weirdan added a commit to weirdan/psalm that referenced this issue Mar 2, 2024
weirdan added a commit to weirdan/psalm that referenced this issue Mar 2, 2024
weirdan added a commit to weirdan/psalm that referenced this issue Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants