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

Sort out the return type of ParserInterface::parse #147

Open
oliverklee opened this issue Apr 2, 2019 · 2 comments
Open

Sort out the return type of ParserInterface::parse #147

oliverklee opened this issue Apr 2, 2019 · 2 comments

Comments

@oliverklee
Copy link
Collaborator

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[]?

@oliverklee
Copy link
Collaborator Author

@mjaschen Do you have any input on this?

@mjaschen
Copy link
Owner

mjaschen commented Jul 1, 2019

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

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

No branches or pull requests

2 participants