Skip to content

getcsv and str_getcsv return values #4993

@mind-bending-forks

Description

@mind-bending-forks

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions