collmex
collmex copied to clipboard
Sort out the return type of ParserInterface::parse
I've found this with the help of Psalm.
Should it be string[]
or string[][]
? And if it is a string[][]
, why does CsvResponse::parseCsv
pass in a string
, not a string[]
?
@mjaschen Do you have any input on this?
Looking from the implementation side (SimpleParser.php) string[][]
would be the correct answer[1] as the parser returns an array of parsed CSV lines which are arrays of strings.
When processing the result in CsvReponse
it's also assumed that an array of arrays is passed as input[2]
[1] https://github.com/mjaschen/collmex/blob/master/src/Csv/SimpleParser.php#L37 [2] https://github.com/mjaschen/collmex/blob/master/src/Response/CsvResponse.php#L106