-
Notifications
You must be signed in to change notification settings - Fork 668
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
filter_input return type confusion when using named parameters and leaving out the filter
argument
#10809
Comments
I found these snippets: https://psalm.dev/r/23882663dc<?php
$a = filter_input(INPUT_POST, 'message', FILTER_DEFAULT, FILTER_FORCE_ARRAY);
assert(is_array($a));
$a = filter_input(INPUT_POST, 'message', FILTER_DEFAULT, options: FILTER_FORCE_ARRAY);
assert(is_array($a));
$a = filter_input(INPUT_POST, 'message', filter: FILTER_DEFAULT, options: FILTER_FORCE_ARRAY);
assert(is_array($a));
$a = filter_input(INPUT_POST, 'message', options: FILTER_FORCE_ARRAY);
assert(is_array($a));
|
/cc: @kkmuffme |
Named arguments aren't supported by the params provider yet - which is the case for most return type providers in psalm too. @pilif feel free to give a PR a try to add support for named arguments - if you need any help just let us know here. |
@kkmuffme PR is attached for the |
Unfortunately, for some cases this won't be possible since PHP native functions that have variadic args have inconsistent behavior with how variadic userland functions work, so those would have to be handled separately anyway. |
https://psalm.dev/r/23882663dc
all calls are equivalent, yet the last one does not yield the expected result.
The text was updated successfully, but these errors were encountered: