diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 20:23:04 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 20:23:04 +0900 |
| commit | e4402e52c08b8b28497151302c994793ce885cc3 (patch) | |
| tree | b1a12dd3941c95d1b64ed4f38a38902eecf2ff18 /crates/shirabe/src/command/diagnose_command.rs | |
| parent | aa270b53045cc1ce779447f4f19448236e9c4c67 (diff) | |
| download | php-shirabe-e4402e52c08b8b28497151302c994793ce885cc3.tar.gz php-shirabe-e4402e52c08b8b28497151302c994793ce885cc3.tar.zst php-shirabe-e4402e52c08b8b28497151302c994793ce885cc3.zip | |
refactor(php-shim): drop current()/key()/end() array helpers
PHP's internal array pointer (current/key/end) has no clean Rust
equivalent. Remove these todo!() shim stubs and replace each call
site with direct first/last element access matching Composer's
original behavior. Unblocks Config::merge of anonymous {name: false}
disable entries, re-enabling test_add_packagist_repository.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/diagnose_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/diagnose_command.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index 4b1c241..1210956 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -15,8 +15,8 @@ use shirabe_php_shim::{ PHP_VERSION, PHP_VERSION_ID, PHP_WINDOWS_VERSION_BUILD, PhpMixed, RuntimeException, count, curl_version, defined, disk_free_space, extension_loaded, file_exists, filter_var_boolean, function_exists, get_class, get_class_err, hash, implode, ini_get, ioncube_loader_iversion, - ioncube_loader_version, is_array, is_string, key, ob_get_clean, ob_start, phpinfo, reset, - rtrim, sprintf, str_contains, str_replace, str_starts_with, strpos, strstr, strtolower, trim, + ioncube_loader_version, is_array, is_string, ob_get_clean, ob_start, phpinfo, reset, rtrim, + sprintf, str_contains, str_replace, str_starts_with, strpos, strstr, strtolower, trim, version_compare, }; use std::cell::RefCell; @@ -690,12 +690,10 @@ impl DiagnoseCommand { let path = str_replace( "%hash%", hash_val.as_string().unwrap_or(""), - &key(provider_includes + &provider_includes .as_array() - .cloned() - .unwrap_or_default() - .into()) - .unwrap_or_default(), + .and_then(|a| a.keys().next().cloned()) + .unwrap_or_default(), ); let response = self.http_downloader.as_ref().unwrap().borrow_mut().get( &format!("{}://repo.packagist.org/{}", protocol, path), |
