FIX: oauth: php 8 warnings (#34027)

* FIX: oauth: fix php 8 warnings (backport of 9edfb1d113)

* FIX: oauth: fix php 8 warnings (backport of 9edfb1d113), part 2
This commit is contained in:
Marc de Lima Lucio
2025-05-04 11:20:26 +02:00
committed by GitHub
parent 8e0d3911e6
commit 02588036c2
3 changed files with 10 additions and 11 deletions

View File

@@ -59,15 +59,14 @@ abstract class AbstractClient implements ClientInterface
/**
* @param array $headers
*/
public function normalizeHeaders(&$headers)
public function normalizeHeaders($headers): array
{
// Normalize headers
array_walk(
$headers,
function (&$val, &$key) {
$key = ucfirst(strtolower($key));
$normalizeHeaders = [];
foreach ($headers as $key => $val) {
$val = ucfirst(strtolower($key)) . ': ' . $val;
$normalizeHeaders[$key] = $val;
}
);
return $normalizeHeaders;
}
}

View File

@@ -70,7 +70,7 @@ class CurlClient extends AbstractClient
// Normalize method name
$method = strtoupper($method);
$this->normalizeHeaders($extraHeaders);
$extraHeaders = $this->normalizeHeaders($extraHeaders);
if ($method === 'GET' && !empty($requestBody)) {
throw new \InvalidArgumentException('No body expected for "GET" request.');

View File

@@ -33,7 +33,7 @@ class StreamClient extends AbstractClient
// Normalize method name
$method = strtoupper($method);
$this->normalizeHeaders($extraHeaders);
$extraHeaders = $this->normalizeHeaders($extraHeaders);
if ($method === 'GET' && !empty($requestBody)) {
throw new \InvalidArgumentException('No body expected for "GET" request.');