From e8d6a57d157ab778108bcb044a3dfa5952d4a5ae Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Jun 2026 18:47:59 +0900 Subject: feat(phase-c): resolve dynamic-dispatch phase-b TODOs Replace the PHP `call_user_func([$obj, $method], ...)` / `$obj->{'get'.$x}()` dynamic dispatches (category E) with static Rust dispatch. - json_config_source: inject the clean-update as a typed `FnOnce(&mut JsonManipulator) -> Result` closure instead of a method-name string, dropping the call_user_func_array round-trip through PhpMixed args. The auth-config method override moves into the add/remove_config_setting closures. - config_command: dispatch addConfigSetting/addProperty on the concrete JsonConfigSource via match. - locker: select getRequires/getDevRequires and getReplaces/getProvides via match on the existing handle getters (previously stubbed to empty Vec). - create_project_command: reuse the existing get_links_for_type helper. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/create_project_command.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/command/create_project_command.rs') diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index bbde603..c2e9b99 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -557,18 +557,14 @@ impl CreateProjectCommand { )?)), false, ); - for (r#type, meta) in SUPPORTED_LINK_TYPES.iter() { - // PHP: $package->{'get'.$meta['method']}() — dynamic getter dispatch - // TODO(phase-b): dynamic getter dispatch by name - let _method = format!("get{}", meta.method); - let links: Vec = vec![]; - for link in links { + for (r#type, _meta) in SUPPORTED_LINK_TYPES.iter() { + for link in package.get_links_for_type(r#type).values() { if link.get_pretty_constraint() == "self.version" { config_source.add_link( r#type, link.get_target(), &package.get_pretty_version(), - ); + )?; } } } -- cgit v1.3.1