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

Warn if opts are in params #1027

Merged
merged 2 commits into from
Oct 15, 2020
Merged

Conversation

vcheung-stripe
Copy link
Contributor

@vcheung-stripe vcheung-stripe commented Oct 14, 2020

Summary

Warn the user if they mistakenly put options into the $params argument to a method, similar to the Stripe Node warning. For example, we warn when the user includes an api_key in $params.

Motivation

https://jira.corp.stripe.com/browse/DX-6065

Testing

Unit tests

@vcheung-stripe
Copy link
Contributor Author

First time writing PHP, so not sure if I'm following the right conventions or even putting code in the write place. Would love nitpicks.

Copy link
Contributor

@richardm-stripe richardm-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic!

@richardm-stripe
Copy link
Contributor

Since you asked for nits: sometimes I prefer a foreach vs. \array_filter in PHP when I would do the opposite in e.g. Javascript because lambdas have a heavy syntax. I also lean towards variable interpolation rather than \sprintf, but there are precedents for both \array_filter and \sprintf already in stripe-php and would not necessarily change what you have.

@vcheung-stripe
Copy link
Contributor Author

Since you asked for nits: sometimes I prefer a foreach vs. \array_filter in PHP when I would do the opposite in e.g. Javascript because lambdas have a heavy syntax. I also lean towards variable interpolation rather than \sprintf, but there are precedents for both \array_filter and \sprintf already in stripe-php and would not necessarily change what you have.

Will keep what I have, but good to know.

@vcheung-stripe vcheung-stripe changed the title [WIP] Warn if opts are in params Warn if opts are in params Oct 15, 2020
@vcheung-stripe vcheung-stripe merged commit ee0bba5 into master Oct 15, 2020
@vcheung-stripe vcheung-stripe deleted the vcheung/warn-if-opts-are-in-params branch October 15, 2020 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants