Skip to content

Commit

Permalink
Improved php type hints (#1794)
Browse files Browse the repository at this point in the history
* Improved PHP type hinting for beta SDKs

* Fixed issue with union and intersectioned types

* Updated phpdocs

* Updated with string literal unions
  • Loading branch information
prathmesh-stripe authored Dec 20, 2024
1 parent 32e66ac commit 231848d
Show file tree
Hide file tree
Showing 289 changed files with 1,390 additions and 1,390 deletions.
26 changes: 13 additions & 13 deletions lib/Account.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/AccountLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AccountLink extends ApiResource
* platform can redirect their user to in order to take them through the Connect
* Onboarding flow.
*
* @param null|array $params
* @param null|array{account: string, collect?: string, collection_options?: array{fields?: string, future_requirements?: string}, expand?: string[], refresh_url?: string, return_url?: string, type: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down
8 changes: 4 additions & 4 deletions lib/AccountNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|int $deadline When present, the deadline for sending the notice to meet the relevant regulations.
* @property null|\Stripe\StripeObject $email Information about the email when sent.
* @property null|\Stripe\StripeObject $linked_objects Information about objects related to the notice.
* @property null|(object{plain_text: string, recipient: string, subject: string}&\Stripe\StripeObject&\stdClass) $email Information about the email when sent.
* @property null|(object{capability: null|string, issuing_credit_underwriting_record?: null|string, issuing_dispute: null|string}&\Stripe\StripeObject&\stdClass) $linked_objects Information about objects related to the notice.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $reason Reason the notice is being sent. The reason determines what copy the notice must contain. See the <a href="https://stripe.com/docs/issuing/compliance-us/issuing-regulated-customer-notices">regulated customer notices</a> guide. All reasons might not apply to your integration, and Stripe might add new reasons in the future, so we recommend an internal warning when you receive an unknown reason.
Expand Down Expand Up @@ -45,7 +45,7 @@ class AccountNotice extends ApiResource
* in descending order by creation date, with the most-recently-created object
* appearing first.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, sent?: bool, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down Expand Up @@ -82,7 +82,7 @@ public static function retrieve($id, $opts = null)
* Updates an <code>AccountNotice</code> object.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{email: array{plain_text: string, recipient: string, subject: string}, expand?: string[], metadata?: \Stripe\StripeObject, sent_at: int} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down
4 changes: 2 additions & 2 deletions lib/AccountSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $account The ID of the account the AccountSession was created for
* @property string $client_secret <p>The client secret of this AccountSession. Used on the client to set up secure access to the given <code>account</code>.</p><p>The client secret can be used to provide access to <code>account</code> from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs to <a href="https://stripe.com/docs/connect/get-started-connect-embedded-components">setup Connect embedded components</a> and learn about how <code>client_secret</code> should be handled.</p>
* @property \Stripe\StripeObject $components
* @property (object{account_management: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), account_onboarding: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), balances: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, edit_payout_schedule: bool, external_account_collection: bool, instant_payouts: bool, standard_payouts: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), capital_financing?: null|(object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), capital_financing_application?: null|(object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), capital_financing_promotion?: null|(object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), documents: (object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), notification_banner: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), payment_details: (object{enabled: bool, features: (object{capture_payments: bool, destination_on_behalf_of_charge_management: bool, dispute_management: bool, refund_management: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), payments: (object{enabled: bool, features: (object{capture_payments: bool, destination_on_behalf_of_charge_management: bool, dispute_management: bool, refund_management: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), payouts: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, edit_payout_schedule: bool, external_account_collection: bool, instant_payouts: bool, standard_payouts: bool}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), payouts_list: (object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), tax_registrations: (object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass), tax_settings: (object{enabled: bool, features: (object{}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass) $components
* @property int $expires_at The timestamp at which this AccountSession will expire.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
Expand All @@ -28,7 +28,7 @@ class AccountSession extends ApiResource
* Creates a AccountSession object that includes a single-use token that the
* platform can use on their front-end to grant client-side API access.
*
* @param null|array $params
* @param null|array{account: string, components: array{account_management?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, account_onboarding?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, app_install?: array{enabled: bool, features?: array{allowed_apps?: null|string[]}}, app_viewport?: array{enabled: bool, features?: array{allowed_apps?: null|string[]}}, balances?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, edit_payout_schedule?: bool, external_account_collection?: bool, instant_payouts?: bool, standard_payouts?: bool}}, capital_financing?: array{enabled: bool, features?: array{}}, capital_financing_application?: array{enabled: bool, features?: array{}}, capital_financing_promotion?: array{enabled: bool, features?: array{}}, capital_overview?: array{enabled: bool, features?: array{}}, documents?: array{enabled: bool, features?: array{}}, financial_account?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool, send_money?: bool, transfer_balance?: bool}}, financial_account_transactions?: array{enabled: bool, features?: array{card_spend_dispute_management?: bool}}, issuing_card?: array{enabled: bool, features?: array{card_management?: bool, card_spend_dispute_management?: bool, cardholder_management?: bool, spend_control_management?: bool}}, issuing_cards_list?: array{enabled: bool, features?: array{card_management?: bool, card_spend_dispute_management?: bool, cardholder_management?: bool, disable_stripe_user_authentication?: bool, spend_control_management?: bool}}, notification_banner?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, payment_details?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payment_method_settings?: array{enabled: bool, features?: array{}}, payments?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payouts?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, edit_payout_schedule?: bool, external_account_collection?: bool, instant_payouts?: bool, standard_payouts?: bool}}, payouts_list?: array{enabled: bool, features?: array{}}, recipients?: array{enabled: bool, features?: array{send_money?: bool}}, reporting_chart?: array{enabled: bool, features?: array{}}, tax_registrations?: array{enabled: bool, features?: array{}}, tax_settings?: array{enabled: bool, features?: array{}}}, expand?: string[]} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down
4 changes: 2 additions & 2 deletions lib/ApplePayDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ApplePayDomain extends ApiResource
/**
* Create an apple pay domain.
*
* @param null|array $params
* @param null|array{domain_name: string, expand?: string[]} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down Expand Up @@ -61,7 +61,7 @@ public function delete($params = null, $opts = null)
/**
* List apple pay domains.
*
* @param null|array $params
* @param null|array{domain_name?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down
4 changes: 2 additions & 2 deletions lib/ApplicationFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @property string|\Stripe\Charge $charge ID of the charge that the application fee was taken from.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|\Stripe\StripeObject $fee_source Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
* @property null|(object{charge?: string, payout?: string, type: string}&\Stripe\StripeObject&\stdClass) $fee_source Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string|\Stripe\Charge $originating_transaction ID of the corresponding charge on the platform account, if this fee was the result of a charge using the <code>destination</code> parameter.
* @property bool $refunded Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
Expand All @@ -31,7 +31,7 @@ class ApplicationFee extends ApiResource
* Returns a list of application fees you’ve previously collected. The application
* fees are returned in sorted order, with the most recent fees appearing first.
*
* @param null|array $params
* @param null|array{charge?: string, created?: int|array, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down
6 changes: 3 additions & 3 deletions lib/Apps/Secret.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $name A name for the secret that's unique within the scope.
* @property null|string $payload The plaintext secret value to be stored.
* @property \Stripe\StripeObject $scope
* @property (object{type: string, user?: string}&\Stripe\StripeObject&\stdClass) $scope
*/
class Secret extends \Stripe\ApiResource
{
Expand All @@ -32,7 +32,7 @@ class Secret extends \Stripe\ApiResource
/**
* Create or replace a secret in the secret store.
*
* @param null|array $params
* @param null|array{expand?: string[], expires_at?: int, name: string, payload: string, scope: array{type: string, user?: string}} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand All @@ -54,7 +54,7 @@ public static function create($params = null, $options = null)
/**
* List all secrets stored on the given scope.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, scope: array{type: string, user?: string}, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
Expand Down
10 changes: 5 additions & 5 deletions lib/Balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
* Related guide: <a href="https://stripe.com/docs/connect/account-balances">Understanding Connect account balances</a>
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject[] $available Available funds that you can transfer or pay out automatically by Stripe or explicitly through the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. You can find the available balance for each currency and payment type in the <code>source_types</code> property.
* @property null|\Stripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">account.controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the <code>source_types</code> property.
* @property null|\Stripe\StripeObject[] $instant_available Funds that you can pay out using Instant Payouts.
* @property null|\Stripe\StripeObject $issuing
* @property (object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)[] $available Available funds that you can transfer or pay out automatically by Stripe or explicitly through the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. You can find the available balance for each currency and payment type in the <code>source_types</code> property.
* @property null|(object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)[] $connect_reserved Funds held due to negative balances on connected accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">account.controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the <code>source_types</code> property.
* @property null|(object{amount: int, currency: string, net_available?: (object{amount: int, destination: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)[], source_types?: (object{bank_account?: int, card?: int, fpx?: int}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)[] $instant_available Funds that you can pay out using Instant Payouts.
* @property null|(object{available: (object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)[]}&\Stripe\StripeObject&\stdClass) $issuing
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject[] $pending Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the <code>source_types</code> property.
* @property (object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&\Stripe\StripeObject&\stdClass)}&\Stripe\StripeObject&\stdClass)[] $pending Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the <code>source_types</code> property.
*/
class Balance extends SingletonApiResource
{
Expand Down
Loading

0 comments on commit 231848d

Please sign in to comment.