diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 21:22:22 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 21:33:05 +0900 |
| commit | 8bd02532cd04ee12d7595029c206f3dc5ab9dd96 (patch) | |
| tree | 5f9897bfefcb9a503d92560311c4d95ee620a025 /crates/shirabe/src/util/auth_helper.rs | |
| parent | c0b743c8d75813003756a72d2fdd110de8368b5f (diff) | |
| download | php-shirabe-8bd02532cd04ee12d7595029c206f3dc5ab9dd96.tar.gz php-shirabe-8bd02532cd04ee12d7595029c206f3dc5ab9dd96.tar.zst php-shirabe-8bd02532cd04ee12d7595029c206f3dc5ab9dd96.zip | |
chore(shirabe): remove ports of PHP @deprecated APIs
Composer does not use its own deprecated APIs internally, so drop their
Rust ports: whole deprecated classes, methods, constants, and field.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/auth_helper.rs')
| -rw-r--r-- | crates/shirabe/src/util/auth_helper.rs | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index 0465b10..61970f2 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -5,9 +5,9 @@ use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::Preg; use shirabe_php_shim::{ - E_USER_DEPRECATED, PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PhpMixed, RuntimeException, - base64_encode, explode, in_array, is_array, is_string, json_decode, parse_url, sprintf, - str_replace, strpos, strtolower, substr, trigger_error, trim, + PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PhpMixed, RuntimeException, base64_encode, explode, + in_array, is_array, is_string, json_decode, parse_url, sprintf, str_replace, strpos, + strtolower, substr, trim, }; use crate::config::Config; @@ -478,47 +478,6 @@ impl AuthHelper { }) } - /// @deprecated use addAuthenticationOptions instead - /// - /// @param string[] $headers - /// - /// @return string[] updated headers array - pub fn add_authentication_header( - &mut self, - headers: Vec<String>, - origin: &str, - url: &str, - ) -> Result<Vec<String>> { - trigger_error( - "AuthHelper::addAuthenticationHeader is deprecated since Composer 2.9 use addAuthenticationOptions instead.", - E_USER_DEPRECATED, - ); - - // PHP: $options = ['http' => ['header' => &$headers]]; - // PHP uses references so subsequent mutations affect $headers - let mut options: IndexMap<String, PhpMixed> = IndexMap::new(); - let mut http: IndexMap<String, Box<PhpMixed>> = IndexMap::new(); - http.insert( - "header".to_string(), - Box::new(PhpMixed::List( - headers - .iter() - .map(|h| Box::new(PhpMixed::String(h.clone()))) - .collect(), - )), - ); - options.insert("http".to_string(), PhpMixed::Array(http)); - - let options = self.add_authentication_options(options, origin, url)?; - - let http = options.get("http").and_then(|v| v.as_array()).unwrap(); - let header = http.get("header").and_then(|v| v.as_list()).unwrap(); - Ok(header - .iter() - .filter_map(|v| v.as_string().map(|s| s.to_string())) - .collect()) - } - /// @param array<string, mixed> $options /// /// @return array<string, mixed> updated options |
