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

Improved php type hints #1794

Merged
merged 4 commits into from
Dec 20, 2024
Merged

Conversation

prathmesh-stripe
Copy link
Contributor

@prathmesh-stripe prathmesh-stripe commented Dec 11, 2024

Related Issues:
#1787
#1740

Changelog

Adds Create/Update/Retrieve/Delete/All/Search parameters

You will now be able to get type hints of the keys that can passed without switching out of your IDE. Eg.

* @param null|array{customer:string, components: array} $params
PHPStorm IDE with array type hints

Updated StripeObject class properties

We changed the type of class properties from StripeObject to something more specific.

For example: Invoice settings was defined as a StripeObject in Customer resource.

* @property null|\Stripe\StripeObject $invoice_settings

Now you will be able to reference custom_fields and rendering_options on customer->invoice_settings without PHPStan complaining.

* @property object{custom_fields: null|object{name: string, value: string}&\Stripe\StripeObject&\stdClass[], default_payment_method: null|string|\Stripe\PaymentMethod, footer: null|string, rendering_options: null|object{amount_tax_display: null|string, template: null|string}&\Stripe\StripeObject&\stdClass}&\Stripe\StripeObject&\stdClass $invoice_settings
 */

@helenye-stripe
Copy link
Contributor

Can we add a changelog entry?

@prathmesh-stripe prathmesh-stripe force-pushed the prathmesh/improved-php-type-hints branch from fecce93 to 02b76c0 Compare December 19, 2024 22:16
@prathmesh-stripe prathmesh-stripe merged commit 231848d into beta Dec 20, 2024
22 checks passed
@prathmesh-stripe prathmesh-stripe deleted the prathmesh/improved-php-type-hints branch December 20, 2024 18:05
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.

2 participants