Skip to content

Extract FilterFunctionReturnTypeHelper#2190

Merged
ondrejmirtes merged 1 commit intophpstan:1.9.xfrom
herndlm:extract-filter-function-return-type-helper
Jan 20, 2023
Merged

Extract FilterFunctionReturnTypeHelper#2190
ondrejmirtes merged 1 commit intophpstan:1.9.xfrom
herndlm:extract-filter-function-return-type-helper

Conversation

@herndlm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants