From fce44d4587ba11b080fe0266c483d0be684ffd0d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 12:51:24 +0900 Subject: refactor(php-shim): split json_decode into assoc and obj variants The assoc flag was always a literal at every call site, so the boolean carried no information the function name could not. json_decode_assoc and json_decode_obj make the resulting PhpMixed shape visible at the call site. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/util/gitlab.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/src/util/gitlab.rs') diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs index ef68c82f..52707b5b 100644 --- a/crates/shirabe/src/util/gitlab.rs +++ b/crates/shirabe/src/util/gitlab.rs @@ -12,7 +12,8 @@ use indexmap::IndexMap; use shirabe_pcre::Preg; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ - PhpMixed, RuntimeException, http_build_query, in_array_strict, json_decode, php_regex, time, + PhpMixed, RuntimeException, http_build_query, in_array_strict, json_decode_assoc, php_regex, + time, }; #[derive(Debug)] @@ -253,7 +254,7 @@ impl GitLab { Some(te) if te.get_code() == 403 || te.get_code() == 401 => { if te.get_code() == 401 { let response = - te.get_response().and_then(|r| json_decode(r, true).ok()); + te.get_response().and_then(|r| json_decode_assoc(r).ok()); let is_invalid_grant = response .as_ref() .and_then(|r| r.as_array()) -- cgit v1.3.1-4-g156e