Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+14 -3
View File
@@ -3,9 +3,9 @@
namespace Stripe\Util;
/**
* @phpstan-type RequestOptionsArray array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string, stripe_version?: string, api_base?: string, max_network_retries?: int }
* @phpstan-type RequestOptionsArray array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string|\Stripe\StripeContext, stripe_version?: string, api_base?: string, max_network_retries?: int, headers?: Array }
*
* @psalm-type RequestOptionsArray = array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string, stripe_version?: string, api_base?: string, max_network_retries?: int }
* @psalm-type RequestOptionsArray = array{api_key?: string, idempotency_key?: string, stripe_account?: string, stripe_context?: string|\Stripe\StripeContext, stripe_version?: string, api_base?: string, max_network_retries?: int, headers?: Array }
*/
class RequestOptions
{
@@ -14,6 +14,7 @@ class RequestOptions
*/
public static $HEADERS_TO_PERSIST = [
'Stripe-Account',
'Stripe-Context',
'Stripe-Version',
];
@@ -79,6 +80,12 @@ class RequestOptions
}
$other_options->headers = \array_merge($this->headers, $other_options->headers);
// special handling for stripe_context
// if other sent an empty string, then we should unset
if (\array_key_exists('Stripe-Context', $other_options->headers) && '' === $other_options->headers['Stripe-Context']) {
unset($other_options->headers['Stripe-Context']);
}
return $other_options;
}
@@ -147,7 +154,7 @@ class RequestOptions
}
if (\array_key_exists('stripe_context', $options)) {
if (null !== $options['stripe_context']) {
$headers['Stripe-Context'] = $options['stripe_context'];
$headers['Stripe-Context'] = (string) $options['stripe_context'];
}
unset($options['stripe_context']);
}
@@ -167,6 +174,10 @@ class RequestOptions
$base = $options['api_base'];
unset($options['api_base']);
}
if (\array_key_exists('headers', $options)) {
$headers = \array_merge($headers, $options['headers']);
unset($options['headers']);
}
if ($strict && !empty($options)) {
$message = 'Got unexpected keys in options array: ' . \implode(', ', \array_keys($options));