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

Fix CURLOPT_POSTFIELDS param type #1782

Merged
merged 2 commits into from Oct 2, 2022

Conversation

ahmedash95
Copy link
Contributor

@ahmedash95 ahmedash95 commented Oct 1, 2022

Hi Ondrej,

CURLOPT_POSTFIELDS accepts string or array but PHPStan reports a type error if the value is not a string
https://phpstan.org/r/db599e65-dfae-4e85-90bc-6bc96feadf96

I'm not sure about TypeCombinator::union but it's what I was able to find to achieve the fix.

closes phpstan/phpstan#8053.

Thanks.

@ondrejmirtes
Copy link
Member

Hi Ahmed :) There's already #1777 but I can't merge it because of coding standards and requirements checker failures. So yours PR might be correct sooner and might win the race :)

Your PR passes but is missing any tests - it'd be nice to add tests for cases when it should pass, and at least one test for the case when the rule should report an error.

Also please base the PR on 1.8.x so it can be released sooner.

@ahmedash95 ahmedash95 changed the base branch from 1.9.x to 1.8.x October 2, 2022 09:54
@ahmedash95
Copy link
Contributor Author

Thanks for pointing out the other PR. I did not know about it because it's not mentioned in the issue.

I've added the tests and changed that base 1.8.x. I assume it's ready to be merged in case the other one is not.

@ondrejmirtes ondrejmirtes merged commit 228a345 into phpstan:1.8.x Oct 2, 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
2 participants