Skip to content

Extract FilterFunctionReturnTypeHelper #2190

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

Merged

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Jan 19, 2023

First step to support the same (crazy, but apparently working) logic via filter_input() too.

@ondrejmirtes
Copy link
Member

How do you expect this helper to be called for filter_input? What's the difference between filter_var and filter_input? Thank you.

@herndlm
Copy link
Contributor Author

herndlm commented Jan 20, 2023

the core logic is the same, filter_var() expects a single mixed var as input, while filter_input() expects an input type (GET/POST/..) and a var name (which would be the array key on the input super global). Additionally filter_input handles the case when the var name offset is not existing at all on the superglobal input array.

https://www.php.net/manual/en/function.filter-var.php vs https://www.php.net/manual/en/function.filter-input.php

See https://github.com/phpstan/phpstan-src/pull/2010/files#diff-8d424599365db1271856abb9d8444194e495d7eebcd0894d0e05dc04d871a6ae for planned usage

@ondrejmirtes ondrejmirtes merged commit 2456975 into phpstan:1.9.x Jan 20, 2023
@ondrejmirtes
Copy link
Member

Thank you 😊

@herndlm herndlm deleted the extract-filter-function-return-type-helper branch January 20, 2023 11:19
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

Successfully merging this pull request may close these issues.

None yet

2 participants