Skip to content

Commit deeec3d

Browse files
committed
fix: 🐛 Delete null values from config
1 parent f28d81a commit deeec3d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Client.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ class Client
111111
*/
112112
public function __construct(array $user_config)
113113
{
114+
$user_config = array_filter($user_config, static fn ($value) => !is_null($value));
115+
114116
$this->http_client = (new Factory())->withOptions([
115-
'connect_timeout' => Arr::get($user_config, 'timeout', 0) ?? 0,
117+
'connect_timeout' => Arr::get($user_config, 'timeout', 0),
116118
'proxy' => Arr::get($user_config, 'http_proxy'),
117-
'verify' => (Arr::get($user_config, 'verify', true) ?? true) ?: (Arr::get($user_config, 'cert_path', false) ?? false)
119+
'verify' => Arr::get($user_config, 'verify', true) ?: Arr::get($user_config, 'cert_path', false)
118120
]);
119121

120122
// Auto discovery
@@ -125,6 +127,7 @@ public function __construct(array $user_config)
125127
"$provider_url/.well-known/openid-configuration",
126128
Arr::get($user_config, 'well_known_request_params')
127129
);
130+
128131
if ($response->ok()) {
129132
$config = $response->collect()->merge($user_config);
130133
}
@@ -158,7 +161,7 @@ public function __construct(array $user_config)
158161
'jwt_plain_key' => false
159162
];
160163
foreach ($props as $prop => $default) {
161-
$this->{$prop} = $config->get($prop, $default) ?? $default;
164+
$this->{$prop} = $config->get($prop, $default);
162165
}
163166

164167
if (empty($this->code_challenge_method)) {

0 commit comments

Comments
 (0)