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

Inconsistent types for stream_select #3036

Closed
kelunik opened this issue Mar 28, 2020 · 2 comments
Closed

Inconsistent types for stream_select #3036

kelunik opened this issue Mar 28, 2020 · 2 comments
Labels
easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted

Comments

@kelunik
Copy link
Contributor

kelunik commented Mar 28, 2020

https://psalm.dev/r/9bb31457dc

$read isn't reported as possibly null, while $write is reported as possibly null. These should be consistent. As long as they're arrays before, they should still be arrays afterwards, I guess.

@psalm-github-bot
Copy link

psalm-github-bot bot commented Mar 28, 2020

I found these snippets:

https://psalm.dev/r/9bb31457dc
<?php

stream_select($read, $write, $except, 0, 0);

foreach ($read as $stream) {
    print (int) $stream;
}

foreach ($write as $stream) {
    print (int) $stream;
}
Psalm output (using commit 47c1470):

ERROR: PossiblyNullIterator - 9:10 - Cannot iterate over nullable var array<array-key, resource>|null

@muglug
Copy link
Collaborator

muglug commented Mar 28, 2020

You're the expert – would you mind creating a PR on CallMap.php?

@orklah orklah added easy problems Issues that can be fixed without background knowledge of Psalm Help wanted labels Oct 20, 2021
@orklah orklah closed this as completed in e198012 Mar 13, 2022
orklah added a commit that referenced this issue Mar 13, 2022
Fix #3036: make argument $read of internal PHP function stream_socket nullable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted
Projects
None yet
Development

No branches or pull requests

3 participants