Skip to content

Commit 83d29d9

Browse files
committed
fix: using default match
1 parent 89b51b1 commit 83d29d9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

system/HTTP/CURLRequest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,12 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
650650
}
651651

652652
// Resolve IP
653-
if (array_key_exists('force_ip_resolve', $config) && is_string($config['force_ip_resolve']) && $config['force_ip_resolve'] !== '') {
654-
$protocolVersion = $config['force_ip_resolve'];
655-
656-
if ($protocolVersion === 'v4') {
657-
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
658-
} elseif ($protocolVersion === 'v6') {
659-
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6;
660-
}
653+
if (array_key_exists('force_ip_resolve', $config)) {
654+
$curlOptions[CURLOPT_IPRESOLVE] = match ($config['force_ip_resolve']) {
655+
'v4' => CURL_IPRESOLVE_V4,
656+
'v6' => CURL_IPRESOLVE_V6,
657+
default => CURL_IPRESOLVE_WHATEVER
658+
};
661659
}
662660

663661
// version

0 commit comments

Comments
 (0)