Skip to content

Commit

Permalink
fix named arg w json_decode to be consistent with php (#473)
Browse files Browse the repository at this point in the history
Co-authored-by: dpi <[email protected]>
  • Loading branch information
staabm and dpi authored Nov 28, 2024
1 parent de2c75b commit d15d3ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/special_cases.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
}
Expand Down

0 comments on commit d15d3ac

Please sign in to comment.