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

Change curl_setopt function signature based on 2nd arg #1719

Merged
merged 5 commits into from Sep 20, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 10, 2022

validates all available curl constants when passed to curl_setopt.

implemeted everything listed on https://www.php.net/manual/en/function.curl-setopt.php - except a few callable-expecting types at the very end. these are a bit more complicated, therefore I left them out for now.

doing similar stuff for curl_setopt_array will be implemented in a followup PR.

closes phpstan/phpstan#7951

@staabm
Copy link
Contributor Author

staabm commented Sep 10, 2022

(lets finish all my other open non-draft PRs before finalizing/discussing this one here. I had a hour of free time.. ;))

@ondrejmirtes
Copy link
Member

Thank you for mapping out the types! However this doesn't need a new rule, just modifications to the function signature on the fly. This is already done for array_map and similar in https://github.com/phpstan/phpstan-src/blob/1.8.x/src/Reflection/ParametersAcceptorSelector.php.

When that's done, the existing rule (call to function parameters) will pick it up and report.

@ondrejmirtes
Copy link
Member

So nice, right? :) Please rebase and solve the conflict, thanks.

@ondrejmirtes ondrejmirtes changed the title implement CurlSetOptRule Change curl_setopt function signature based on 2nd arg Sep 20, 2022
@ondrejmirtes ondrejmirtes merged commit f4a93f6 into phpstan:1.8.x Sep 20, 2022
@ondrejmirtes
Copy link
Member

Thank you!

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