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

ArgumentCountError in fputcsv() #310

Closed
snapshotpl opened this issue Oct 26, 2021 · 5 comments · Fixed by #316
Closed

ArgumentCountError in fputcsv() #310

snapshotpl opened this issue Oct 26, 2021 · 5 comments · Fixed by #316
Labels
bug Something isn't working

Comments

@snapshotpl
Copy link

Version: 2.0.0-alpha.3
PHP: 8.0

fputcsv() expects at most 5 arguments, 6 given

Documentation say:

8.1.0 | The optional eol parameter has been added.

by https://www.php.net/manual/en/function.fputcsv.php

@dbrekelmans dbrekelmans added the bug Something isn't working label Oct 28, 2021
@dbrekelmans
Copy link
Collaborator

Thanks for reporting @snapshotpl,

We will have to pin the phpdocs that we use for generation to a certain commit that contains the php8 docs and not the php8.1.
A PR for php7.4 is already open, which would be targeting a 1.x branch: #292

@Jean85
Copy link
Contributor

Jean85 commented Jan 5, 2022

@dbrekelmans we can surely pin to that, but wouldn't this make the library compatible with 8.0.* only? How would you deal with SemVer? And what about downstream libs, how could they pin against this lib?

@dbrekelmans
Copy link
Collaborator

Hi @Jean85, yes that would be the case. It would require us to make a new minor for each php version. It's definitely not ideal.

I think the ideal situation (in my opinion) would be to keep track of some sort of delta like phpstan and psalm do (example: https://github.com/phpstan/phpstan-src/blob/master/resources/functionMap_php80delta.php).
In fact, I would love it if Safe would take phpstan as the base source of truth and only fall back to the php docs if phpstan is missing knowledge.

This would be a big refactor though, which I personally don't have the time for at the moment, but if anyone is willing to try then I definitely want to encourage them!

@Jean85
Copy link
Contributor

Jean85 commented Jan 5, 2022

@dbrekelmans I would like to give it a try, but I'm not sure that I understood your suggestion... How would this work? Do you want to generate the functions conditionally using PHPStan as a source of truth? Also, PHPStan seems to be listing a lot more functions that we would want... We would still need to use the doc as a listing, and then use PHPStan as a primary source for signature.

In the meantime, I've wrote #316 as a (temporary?) fix for this issue.

@dbrekelmans
Copy link
Collaborator

@Jean85 Thanks for the PR, I will take a look!

We would still need to use the doc as a listing, and then use PHPStan as a primary source for signature.

Yes that is correct. I was too quick to think we might not need the docs since phpstan knows the return type, but of course we still need to find out from the docs if this is a case of "return false on error"

I have outlined my thoughts in a new issue: #317, so we don't pollute this one :).
If it's not clear or you have any questions, feel free to ask in that issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants