This commit is contained in:
William 2023-01-30 09:15:42 +01:00
parent 0e202e9b96
commit 30c82d69c0
1 changed files with 3 additions and 2 deletions

View File

@ -23,9 +23,10 @@ function config(string $key): bool|string|int|float {
}
foreach (require $config_override_path as $override_key => $override_value) {
if (!array_key_exists($override_key, $config)) {
throw new Exception('Undefined key in config override file');
trigger_error('Undefined key in config file', E_USER_ERROR);
}
if (gettype($override_value) !== gettype($config[$override_key])) {
trigger_error('Type mismatch in config file', E_USER_ERROR);
throw new Exception('Type mismatch in config override file');
}
$config[$override_key] = $override_value;
@ -56,7 +57,7 @@ function json_response(mixed $data, int $status_code = 200)
/**
* Helper for reading and decoding JSON from request body
*/
function json_decode_input(): array
function json_decode_input(): array|bool|null
{
return json_decode(file_get_contents('php://input'), true);
}