diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-16 12:51:24 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-16 12:51:24 +0900 |
| commit | fce44d4587ba11b080fe0266c483d0be684ffd0d (patch) | |
| tree | 753e87ac7ed2e57d635a60c10a4ce01b7e0f0f8e /crates/shirabe/src/command/package_discovery_trait.rs | |
| parent | b12c2b15f0487d54d359a581e99ced68713914d0 (diff) | |
| download | php-shirabe-fce44d4587ba11b080fe0266c483d0be684ffd0d.tar.gz php-shirabe-fce44d4587ba11b080fe0266c483d0be684ffd0d.tar.zst php-shirabe-fce44d4587ba11b080fe0266c483d0be684ffd0d.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/package_discovery_trait.rs')
| -rw-r--r-- | crates/shirabe/src/command/package_discovery_trait.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index b68be252..88c90a5a 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -24,7 +24,7 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ Exception, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, array_keys, array_slice, asort, explode, file_get_contents, implode, in_array_strict, is_array, is_file, - is_numeric, json_decode, levenshtein, php_regex, strlen, strpos, trim, + is_numeric, json_decode_assoc, levenshtein, php_regex, strlen, strpos, trim, }; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -113,7 +113,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { let file = Factory::get_composer_file().unwrap_or_default(); if is_file(&file) && Filesystem::is_readable(&file) { let contents = file_get_contents(&file).unwrap_or_default(); - let composer = json_decode(&contents, true).unwrap_or(PhpMixed::Null); + let composer = json_decode_assoc(&contents).unwrap_or(PhpMixed::Null); if is_array(&composer) && let Some(arr) = composer.as_array() && let Some(ms) = arr.get("minimum-stability") |
