From d15d3ac0286be4b32c99fc0754aabe82165a45b2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 28 Nov 2024 11:30:19 +0100 Subject: [PATCH] fix named arg w json_decode to be consistent with php (#473) Co-authored-by: dpi --- lib/special_cases.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/special_cases.php b/lib/special_cases.php index 8b9e12ff..71159d8f 100644 --- a/lib/special_cases.php +++ b/lib/special_cases.php @@ -25,7 +25,7 @@ * Wrapper for json_decode that throws when an error occurs. * * @param string $json JSON data to parse - * @param bool $assoc When true, returned objects will be converted + * @param bool $associative When true, returned objects will be converted * into associative arrays. * @param int<1, max> $depth User specified recursion depth. * @param int $flags Bitmask of JSON decode options. @@ -34,9 +34,9 @@ * @throws JsonException if the JSON cannot be decoded. * @link http://www.php.net/manual/en/function.json-decode.php */ -function json_decode(string $json, bool $assoc = false, int $depth = 512, int $flags = 0): mixed +function json_decode(string $json, bool $associative = false, int $depth = 512, int $flags = 0): mixed { - $data = \json_decode($json, $assoc, $depth, $flags); + $data = \json_decode($json, $associative, $depth, $flags); if (!($flags & JSON_THROW_ON_ERROR) && JSON_ERROR_NONE !== json_last_error()) { throw JsonException::createFromPhpError(); }