mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 19:41:26 +01:00
FIX: oauth: php 8 warnings (#34027)
* FIX: oauth: fix php 8 warnings (backport of9edfb1d113) * FIX: oauth: fix php 8 warnings (backport of9edfb1d113), part 2
This commit is contained in:
committed by
GitHub
parent
8e0d3911e6
commit
02588036c2
@@ -59,15 +59,14 @@ abstract class AbstractClient implements ClientInterface
|
|||||||
/**
|
/**
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
*/
|
*/
|
||||||
public function normalizeHeaders(&$headers)
|
public function normalizeHeaders($headers): array
|
||||||
{
|
{
|
||||||
// Normalize headers
|
$normalizeHeaders = [];
|
||||||
array_walk(
|
foreach ($headers as $key => $val) {
|
||||||
$headers,
|
$val = ucfirst(strtolower($key)) . ': ' . $val;
|
||||||
function (&$val, &$key) {
|
$normalizeHeaders[$key] = $val;
|
||||||
$key = ucfirst(strtolower($key));
|
}
|
||||||
$val = ucfirst(strtolower($key)) . ': ' . $val;
|
|
||||||
}
|
return $normalizeHeaders;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class CurlClient extends AbstractClient
|
|||||||
// Normalize method name
|
// Normalize method name
|
||||||
$method = strtoupper($method);
|
$method = strtoupper($method);
|
||||||
|
|
||||||
$this->normalizeHeaders($extraHeaders);
|
$extraHeaders = $this->normalizeHeaders($extraHeaders);
|
||||||
|
|
||||||
if ($method === 'GET' && !empty($requestBody)) {
|
if ($method === 'GET' && !empty($requestBody)) {
|
||||||
throw new \InvalidArgumentException('No body expected for "GET" request.');
|
throw new \InvalidArgumentException('No body expected for "GET" request.');
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class StreamClient extends AbstractClient
|
|||||||
// Normalize method name
|
// Normalize method name
|
||||||
$method = strtoupper($method);
|
$method = strtoupper($method);
|
||||||
|
|
||||||
$this->normalizeHeaders($extraHeaders);
|
$extraHeaders = $this->normalizeHeaders($extraHeaders);
|
||||||
|
|
||||||
if ($method === 'GET' && !empty($requestBody)) {
|
if ($method === 'GET' && !empty($requestBody)) {
|
||||||
throw new \InvalidArgumentException('No body expected for "GET" request.');
|
throw new \InvalidArgumentException('No body expected for "GET" request.');
|
||||||
|
|||||||
Reference in New Issue
Block a user