diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-15 09:10:16 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-15 09:10:16 +0900 |
| commit | 9e5bb3e4253dda96345f4d1a3421077a72295048 (patch) | |
| tree | 73237dd78c22e93fe6562a434bb5ffcb03055250 /crates/shirabe/src/repository | |
| parent | 8724f55749a97fe6a6e232d1dd900a069f9b7533 (diff) | |
| download | php-shirabe-9e5bb3e4253dda96345f4d1a3421077a72295048.tar.gz php-shirabe-9e5bb3e4253dda96345f4d1a3421077a72295048.tar.zst php-shirabe-9e5bb3e4253dda96345f4d1a3421077a72295048.zip | |
refactor(php-shim): take only the data argument in http_build_query
`http_build_query` ignores `numeric_prefix` because a string-keyed slice never
holds an integer key, and every caller passes `"&"` as the separator. Drop both
parameters and hard-code the separator.
Callers that pass a map of scalar literals to `http_build_query_mixed` no longer
need to build an `IndexMap<String, PhpMixed>` for it, so move them to the slice
form.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository')
| -rw-r--r-- | crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs | 62 |
1 files changed, 12 insertions, 50 deletions
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index eb64c4f8..c3da08ff 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -19,8 +19,7 @@ use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists, - array_search_mixed, extension_loaded, http_build_query_mixed, implode, is_array, php_regex, - strpos, + array_search_mixed, extension_loaded, http_build_query, implode, is_array, php_regex, strpos, }; #[derive(Debug)] @@ -152,18 +151,7 @@ impl GitBitbucketDriver { "https://api.bitbucket.org/2.0/repositories/{}/{}?{}", self.owner.clone(), self.repository.clone(), - http_build_query_mixed( - &{ - let mut m: IndexMap<String, PhpMixed> = IndexMap::new(); - m.insert( - "fields".to_string(), - PhpMixed::String("-project,-owner".to_string()), - ); - m - }, - "", - "&", - ), + http_build_query(&[("fields", "-project,-owner")]), ); let repo_data = self @@ -524,23 +512,11 @@ impl GitBitbucketDriver { let mut resource = format!( "{}?{}", self.tags_url.clone(), - http_build_query_mixed( - &{ - let mut m: IndexMap<String, PhpMixed> = IndexMap::new(); - m.insert("pagelen".to_string(), PhpMixed::Int(100)); - m.insert( - "fields".to_string(), - PhpMixed::String("values.name,values.target.hash,next".to_string()), - ); - m.insert( - "sort".to_string(), - PhpMixed::String("-target.date".to_string()), - ); - m - }, - "", - "&", - ), + http_build_query(&[ + ("pagelen", "100"), + ("fields", "values.name,values.target.hash,next"), + ("sort", "-target.date"), + ]), ); let mut has_next = true; while has_next { @@ -603,25 +579,11 @@ impl GitBitbucketDriver { let mut resource = format!( "{}?{}", self.branches_url.clone(), - http_build_query_mixed( - &{ - let mut m: IndexMap<String, PhpMixed> = IndexMap::new(); - m.insert("pagelen".to_string(), PhpMixed::Int(100)); - m.insert( - "fields".to_string(), - PhpMixed::String( - "values.name,values.target.hash,values.heads,next".to_string(), - ), - ); - m.insert( - "sort".to_string(), - PhpMixed::String("-target.date".to_string()), - ); - m - }, - "", - "&", - ), + http_build_query(&[ + ("pagelen", "100"), + ("fields", "values.name,values.target.hash,values.heads,next"), + ("sort", "-target.date"), + ]), ); let mut has_next = true; while has_next { |
