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

stream_bucket_new has wrong return type #2430

Closed
pilif opened this issue Dec 6, 2019 · 2 comments · Fixed by #2434
Closed

stream_bucket_new has wrong return type #2430

pilif opened this issue Dec 6, 2019 · 2 comments · Fixed by #2434
Labels

Comments

@pilif
Copy link
Contributor

pilif commented Dec 6, 2019

stream_bucket_new() returns object|bool, but psalm thinks it's returning resource|bool.

This is a problem because the return value of stream_bucket_new() is often passed into stream_bucket_append() which psalm knows takes object as its second argument.

This way it's impossible to write a custom stream filter that passes psalm's InvalidArgument check.

I would have made a quick PR, but I'm not sure whether/if this has changed between PHP versions.

@weirdan
Copy link
Collaborator

weirdan commented Dec 6, 2019

It did returns a resource long time ago, but I think it was changed in PHP5 judging by the list of branches that commit is a part of.

@muglug
Copy link
Collaborator

muglug commented Dec 6, 2019

Please create a PR to CallMap.php!

@muglug muglug added the bug label Dec 6, 2019
pilif added a commit to pilif/psalm that referenced this issue Dec 6, 2019
the function returns `object` since 2003 in
php/php-src@c4a491e and
`stream_bucket_append()` is type hinted to take `object` too.

This fixes vimeo#2430
muglug pushed a commit that referenced this issue Dec 7, 2019
the function returns `object` since 2003 in
php/php-src@c4a491e and
`stream_bucket_append()` is type hinted to take `object` too.

This fixes #2430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants