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

Rename fake magic methods and rewrite array conversion #704

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

ob-stripe
Copy link
Contributor

@ob-stripe ob-stripe commented Aug 22, 2019

r? @brandur-stripe @remi-stripe
cc @stripe/api-libraries

  • Rename the "fake" magic methods __toArray and __toJSON to toArray and toJSON. They weren't actually magic methods so the double underscores were misleading and causing warnings (cf. PHP 7.2 Warnings #587).
  • Rewrite toArray to no longer rely on Util::convertStripeObjectToArray. The implementation is a bit hard to read but it's basically an exact port of the stripe-ruby logic.
    • Also, toArray no longer accepts a $recursive argument and always converts recursively.
  • Remove Util::convertStripeObjectToArray. The method was misleading because it pretended to accept a StripeObject when really it expected the $_values property of a StripeObject. This lead to user confusion (cf. Util::convertToStripeObject and Util::convertStripeObjectToArray don't seem to round-trip #702).

Fixes #587, fixes #702.

@ob-stripe ob-stripe mentioned this pull request Aug 22, 2019
26 tasks
Copy link
Contributor

@brandur-stripe brandur-stripe left a comment

Choose a reason for hiding this comment

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

Nice cleanup! LGTM.

@ob-stripe ob-stripe merged commit 49ca276 into integration-v7 Aug 22, 2019
@ob-stripe ob-stripe deleted the ob-rename-magic-methods branch August 22, 2019 21:16
@ob-stripe ob-stripe mentioned this pull request Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants