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

[codegen] Add PHPDoc types for expandable fields #860

Merged
merged 2 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/ApplicationFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
*
* @property string $id
* @property string $object
* @property string $account
* @property string|\Stripe\Account $account
* @property int $amount
* @property int $amount_refunded
* @property string $application
* @property string|null $balance_transaction
* @property string $charge
* @property string|\Stripe\StripeObject $application
* @property string|\Stripe\BalanceTransaction|null $balance_transaction
* @property string|\Stripe\Charge $charge
* @property int $created
* @property string $currency
* @property bool $livemode
* @property string|null $originating_transaction
* @property string|\Stripe\Charge|null $originating_transaction
* @property bool $refunded
* @property \Stripe\Collection $refunds
*
Expand Down
2 changes: 1 addition & 1 deletion lib/BalanceTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @property \Stripe\StripeObject[] $fee_details
* @property int $net
* @property string $reporting_category
* @property string|null $source
* @property string|\Stripe\StripeObject|null $source
Copy link
Contributor

Choose a reason for hiding this comment

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

did you special case that one? Should we try to be fully complete with all the possible types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, expandable polymorphic fields are not very well handled at the moment and are typed as StripeObject instead of the actual list of possible types.

We have a workaround/hack to handle this in @return type annotations, but it wasn't easy to reuse in this case. I'll try and fix later.

* @property string $status
* @property string $type
*
Expand Down
4 changes: 2 additions & 2 deletions lib/BankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
*
* @property string $id
* @property string $object
* @property string|null $account
* @property string|\Stripe\Account|null $account
* @property string|null $account_holder_name
* @property string|null $account_holder_type
* @property string|null $bank_name
* @property string $country
* @property string $currency
* @property string|null $customer
* @property string|\Stripe\Customer|null $customer
* @property bool|null $default_for_currency
* @property string|null $fingerprint
* @property string $last4
Expand Down
6 changes: 3 additions & 3 deletions lib/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @property string $id
* @property string $object
* @property string|null $account
* @property string|\Stripe\Account|null $account
* @property string|null $address_city
* @property string|null $address_country
* @property string|null $address_line1
Expand All @@ -20,7 +20,7 @@
* @property string $brand
* @property string|null $country
* @property string|null $currency
* @property string|null $customer
* @property string|\Stripe\Customer|null $customer
* @property string|null $cvc_check
* @property bool|null $default_for_currency
* @property string|null $dynamic_last4
Expand All @@ -31,7 +31,7 @@
* @property string $last4
* @property \Stripe\StripeObject $metadata
* @property string|null $name
* @property string|null $recipient
* @property string|\Stripe\Recipient|null $recipient
* @property string|null $tokenization_method
*
* @package Stripe
Expand Down
24 changes: 12 additions & 12 deletions lib/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@
* @property string $object
* @property int $amount
* @property int $amount_refunded
* @property string|null $application
* @property string|null $application_fee
* @property string|\Stripe\StripeObject|null $application
* @property string|\Stripe\ApplicationFee|null $application_fee
* @property int|null $application_fee_amount
* @property string|null $balance_transaction
* @property string|\Stripe\BalanceTransaction|null $balance_transaction
* @property \Stripe\StripeObject $billing_details
* @property bool $captured
* @property int $created
* @property string $currency
* @property string|null $customer
* @property string|\Stripe\Customer|null $customer
* @property string|null $description
* @property string|null $destination
* @property string|null $dispute
* @property string|\Stripe\Account|null $destination
ob-stripe marked this conversation as resolved.
Show resolved Hide resolved
* @property string|\Stripe\Dispute|null $dispute
* @property bool $disputed
* @property string|null $failure_code
* @property string|null $failure_message
* @property \Stripe\StripeObject|null $fraud_details
* @property string|null $invoice
* @property string|\Stripe\Invoice|null $invoice
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property string|null $on_behalf_of
* @property string|null $order
* @property string|\Stripe\Account|null $on_behalf_of
* @property string|\Stripe\Order|null $order
* @property \Stripe\StripeObject|null $outcome
* @property bool $paid
* @property string|null $payment_intent
Expand All @@ -40,14 +40,14 @@
* @property string $receipt_url
* @property bool $refunded
* @property \Stripe\Collection $refunds
* @property string|null $review
* @property string|\Stripe\Review|null $review
* @property \Stripe\StripeObject|null $shipping
* @property \Stripe\StripeObject|null $source
* @property string|null $source_transfer
* @property string|\Stripe\Transfer|null $source_transfer
* @property string|null $statement_descriptor
* @property string|null $statement_descriptor_suffix
* @property string $status
* @property string $transfer
* @property string|\Stripe\Transfer $transfer
* @property \Stripe\StripeObject|null $transfer_data
* @property string|null $transfer_group
*
Expand Down
8 changes: 4 additions & 4 deletions lib/Checkout/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
* @property string|null $billing_address_collection
* @property string $cancel_url
* @property string|null $client_reference_id
* @property string|null $customer
* @property string|\Stripe\Customer|null $customer
* @property string|null $customer_email
* @property \Stripe\StripeObject[]|null $display_items
* @property bool $livemode
* @property string|null $locale
* @property \Stripe\StripeObject|null $metadata
* @property string|null $mode
* @property string|null $payment_intent
* @property string|\Stripe\PaymentIntent|null $payment_intent
* @property string[] $payment_method_types
* @property string|null $setup_intent
* @property string|\Stripe\SetupIntent|null $setup_intent
* @property string|null $submit_type
* @property string|null $subscription
* @property string|\Stripe\Subscription|null $subscription
* @property string $success_url
*
* @package Stripe\Checkout
Expand Down
8 changes: 4 additions & 4 deletions lib/CreditNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
* @property int $amount
* @property int $created
* @property string $currency
* @property string $customer
* @property string|null $customer_balance_transaction
* @property string|\Stripe\Customer $customer
* @property string|\Stripe\CustomerBalanceTransaction|null $customer_balance_transaction
* @property int $discount_amount
* @property string $invoice
* @property string|\Stripe\Invoice $invoice
* @property \Stripe\Collection $lines
* @property bool $livemode
* @property string|null $memo
Expand All @@ -22,7 +22,7 @@
* @property int|null $out_of_band_amount
* @property string $pdf
* @property string|null $reason
* @property string|null $refund
* @property string|\Stripe\Refund|null $refund
* @property string $status
* @property int $subtotal
* @property \Stripe\StripeObject[] $tax_amounts
Expand Down
2 changes: 1 addition & 1 deletion lib/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @property int $balance
* @property int $created
* @property string|null $currency
* @property string|null $default_source
* @property string|\Stripe\StripeObject|null $default_source
Copy link
Contributor

Choose a reason for hiding this comment

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

same as the other, should we try to be complete? Asking because we will need this for dotnet codegen anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.NET uses interfaces for polymorphic types, so it'll be more similar to what we're already doing for Typescript.

* @property bool|null $delinquent
* @property string|null $description
* @property \Stripe\Discount|null $discount
Expand Down
4 changes: 2 additions & 2 deletions lib/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @property string $object
* @property int $amount
* @property \Stripe\BalanceTransaction[] $balance_transactions
* @property string $charge
* @property string|\Stripe\Charge $charge
* @property int $created
* @property string $currency
* @property \Stripe\StripeObject $evidence
Expand All @@ -18,7 +18,7 @@
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property string|null $network_reason_code
* @property string|null $payment_intent
* @property string|\Stripe\PaymentIntent|null $payment_intent
* @property string $reason
* @property string $status
*
Expand Down
2 changes: 1 addition & 1 deletion lib/FileLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @property int $created
* @property bool $expired
* @property int|null $expires_at
* @property string $file
* @property string|\Stripe\File $file
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property string|null $url
Expand Down
12 changes: 6 additions & 6 deletions lib/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
* @property bool $attempted
* @property bool $auto_advance
* @property string|null $billing_reason
* @property string|null $charge
* @property string|\Stripe\Charge|null $charge
* @property string|null $collection_method
* @property int $created
* @property string $currency
* @property \Stripe\StripeObject[]|null $custom_fields
* @property string $customer
* @property string|\Stripe\Customer $customer
* @property \Stripe\StripeObject|null $customer_address
* @property string|null $customer_email
* @property string|null $customer_name
* @property string|null $customer_phone
* @property \Stripe\StripeObject|null $customer_shipping
* @property string|null $customer_tax_exempt
* @property \Stripe\StripeObject[]|null $customer_tax_ids
* @property string|null $default_payment_method
* @property string|null $default_source
* @property string|\Stripe\PaymentMethod|null $default_payment_method
* @property string|\Stripe\StripeObject|null $default_source
* @property \Stripe\TaxRate[]|null $default_tax_rates
* @property string|null $description
* @property \Stripe\Discount|null $discount
Expand All @@ -46,7 +46,7 @@
* @property int|null $next_payment_attempt
* @property string|null $number
* @property bool $paid
* @property string|null $payment_intent
* @property string|\Stripe\PaymentIntent|null $payment_intent
* @property int $period_end
* @property int $period_start
* @property int $post_payment_credit_notes_amount
Expand All @@ -56,7 +56,7 @@
* @property string|null $statement_descriptor
* @property string|null $status
* @property \Stripe\StripeObject $status_transitions
* @property string|null $subscription
* @property string|\Stripe\Subscription|null $subscription
* @property int $subscription_proration_date
* @property int $subtotal
* @property int|null $tax
Expand Down
6 changes: 3 additions & 3 deletions lib/InvoiceItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* @property string $object
* @property int $amount
* @property string $currency
* @property string $customer
* @property string|\Stripe\Customer $customer
* @property int $date
* @property string|null $description
* @property bool $discountable
* @property string|null $invoice
* @property string|\Stripe\Invoice|null $invoice
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property \Stripe\StripeObject $period
* @property \Stripe\Plan|null $plan
* @property bool $proration
* @property int $quantity
* @property string|null $subscription
* @property string|\Stripe\Subscription|null $subscription
* @property string $subscription_item
* @property \Stripe\TaxRate[]|null $tax_rates
* @property bool $unified_proration
Expand Down
2 changes: 1 addition & 1 deletion lib/Issuing/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @property string $authorized_currency
* @property \Stripe\BalanceTransaction[] $balance_transactions
* @property \Stripe\Issuing\Card $card
* @property string|null $cardholder
* @property string|\Stripe\Issuing\Cardholder|null $cardholder
* @property int $created
* @property int $held_amount
* @property string $held_currency
Expand Down
2 changes: 1 addition & 1 deletion lib/Issuing/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @property \Stripe\StripeObject $metadata
* @property string $name
* @property \Stripe\StripeObject|null $pin
* @property string|null $replacement_for
* @property string|\Stripe\Issuing\Card|null $replacement_for
* @property string|null $replacement_reason
* @property \Stripe\StripeObject|null $shipping
* @property string $status
Expand Down
2 changes: 1 addition & 1 deletion lib/Issuing/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @property int $amount
* @property int $created
* @property string $currency
* @property string $disputed_transaction
* @property string|\Stripe\Issuing\Transaction $disputed_transaction
* @property \Stripe\StripeObject $evidence
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
Expand Down
10 changes: 5 additions & 5 deletions lib/Issuing/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* @property string $id
* @property string $object
* @property int $amount
* @property string|null $authorization
* @property string|null $balance_transaction
* @property string $card
* @property string|null $cardholder
* @property string|\Stripe\Issuing\Authorization|null $authorization
* @property string|\Stripe\BalanceTransaction|null $balance_transaction
* @property string|\Stripe\Issuing\Card $card
* @property string|\Stripe\Issuing\Cardholder|null $cardholder
* @property int $created
* @property string $currency
* @property string|null $dispute
* @property string|\Stripe\Issuing\Dispute|null $dispute
* @property bool $livemode
* @property int $merchant_amount
* @property string $merchant_currency
Expand Down
2 changes: 1 addition & 1 deletion lib/Mandate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @property \Stripe\StripeObject $customer_acceptance
* @property bool $livemode
* @property \Stripe\StripeObject $multi_use
* @property string $payment_method
* @property string|\Stripe\PaymentMethod $payment_method
* @property \Stripe\StripeObject $payment_method_details
* @property \Stripe\StripeObject $single_use
* @property string $status
Expand Down
4 changes: 2 additions & 2 deletions lib/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
* @property int|null $amount_returned
* @property string|null $application
* @property int|null $application_fee
* @property string|null $charge
* @property string|\Stripe\Charge|null $charge
* @property int $created
* @property string $currency
* @property string|null $customer
* @property string|\Stripe\Customer|null $customer
* @property string|null $email
* @property string $external_coupon_code
* @property \Stripe\OrderItem[] $items
Expand Down
4 changes: 2 additions & 2 deletions lib/OrderReturn.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @property string $currency
* @property \Stripe\OrderItem[] $items
* @property bool $livemode
* @property string|null $order
* @property string|null $refund
* @property string|\Stripe\Order|null $order
* @property string|\Stripe\Refund|null $refund
*
* @package Stripe
*/
Expand Down
14 changes: 7 additions & 7 deletions lib/PaymentIntent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @property int $amount
* @property int $amount_capturable
* @property int $amount_received
* @property string|null $application
* @property string|\Stripe\StripeObject|null $application
* @property int|null $application_fee_amount
* @property int|null $canceled_at
* @property string|null $cancellation_reason
Expand All @@ -20,22 +20,22 @@
* @property string $confirmation_method
* @property int $created
* @property string $currency
* @property string|null $customer
* @property string|\Stripe\Customer|null $customer
* @property string|null $description
* @property string|null $invoice
* @property string|\Stripe\Invoice|null $invoice
* @property \Stripe\ErrorObject|null $last_payment_error
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property \Stripe\StripeObject|null $next_action
* @property string|null $on_behalf_of
* @property string|null $payment_method
* @property string|\Stripe\Account|null $on_behalf_of
* @property string|\Stripe\PaymentMethod|null $payment_method
* @property \Stripe\StripeObject|null $payment_method_options
* @property string[] $payment_method_types
* @property string|null $receipt_email
* @property string|null $review
* @property string|\Stripe\Review|null $review
* @property string|null $setup_future_usage
* @property \Stripe\StripeObject|null $shipping
* @property string|null $source
* @property string|\Stripe\StripeObject|\Stripe\StripeObject|null $source
* @property string|null $statement_descriptor
* @property string|null $statement_descriptor_suffix
* @property string $status
Expand Down
Loading