Specify return type for filter_input()#2010
Conversation
3c28408 to
41e927e
Compare
|
This pull request has been marked as ready for review. |
41e927e to
dade61f
Compare
22740d4 to
ff19000
Compare
|
This pull request has been marked as ready for review. |
3ca69d1 to
2ec1ef0
Compare
2ec1ef0 to
84d53c7
Compare
|
do you think we can get that this one in the next release? 😊 it's 90% refactor and would help me get rid of some errors in a legacy app which helps me finish the 7.4 -> 8.x upgrade. at least that's what I was telling myself when I was last procrastinating when working on it :D |
|
This pull request has been marked as ready for review. |
|
Fyi the return type in case the array offset does not exist and the force array flag is set is not handled properly. It's a bit tricky and I might need to refactor the helper maybe. Good that you didn't merge it yet 😅 |
4959e62 to
45e9d42
Compare
45e9d42 to
30070eb
Compare
|
I'm happy with this now, maybe the new method in the helper is useful for #2257 too. |
|
This pull request has been marked as ready for review. |
23874d7 to
7db3ed6
Compare
There was a problem hiding this comment.
I don't like that this condition only works for literal INPUT_GET ConstFetch in the code, but doesn't work for @param INPUT_GET|INPUT_POST $abc from PHPDocs.
There was a problem hiding this comment.
so rebasing does summon you :D
good point, I also dislike that. I'm not good with constants, do you have any better ideas you can think of? Do I need to resolve them somehow I suppose?
There was a problem hiding this comment.
I thought this is already a solved problem, FilterFunctionReturnTypeHelper does this with hasFlag, $this->getConstant() etc.
There was a problem hiding this comment.
yeah that would work I guess, I thought there's a better approach. I'll switch it to use those helpers then :)
There was a problem hiding this comment.
adapted. I could not re-use those methods but found another approach. not sure yet if there's a better one though
can still be made stricter / more correct any time
|
Thank you! |
Closes phpstan/phpstan#6261
See https://www.php.net/manual/en/function.filter-input.php, the important difference to
filter_varis the handling of the non-set variables in the superglobal arrays