-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#4182Labels
Description
My reading of fgetcsv in the PHP docs, is that it returns an indexed array (of strings), or [ null ] (for the empty line case), or false, or null. Since the empty line case results in an array with 1 element, there will always be at least one. I would not expect this example to generate any errors.
Its defined signature in resources/functionMap.php is currently '(?array)|(?false)'. Being strict about it, I think it should be non-empty-array<int,string>|array{null}|false|null.
Similarly, I think thatstr_getcsv returns a non-empty indexed array of strings or [ null ] for an empty string, and so should have the signature non-empty-array<int,string>|array{null}.
Thanks.
Edit: Corrected typo
Reactions are currently unavailable