diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-07 18:47:59 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-07 19:29:26 +0900 |
| commit | e8d6a57d157ab778108bcb044a3dfa5952d4a5ae (patch) | |
| tree | eaa30eeee79b2c04ca95be843ae6a9dda69af246 /crates/shirabe/src/command/create_project_command.rs | |
| parent | b8a50e25aafb51a6d73f9695362854cc5ed58117 (diff) | |
| download | php-shirabe-e8d6a57d157ab778108bcb044a3dfa5952d4a5ae.tar.gz php-shirabe-e8d6a57d157ab778108bcb044a3dfa5952d4a5ae.tar.zst php-shirabe-e8d6a57d157ab778108bcb044a3dfa5952d4a5ae.zip | |
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<bool>` 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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/create_project_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/create_project_command.rs | 10 |
1 files changed, 3 insertions, 7 deletions
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<crate::package::Link> = 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(), - ); + )?; } } } |
