diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-11 16:37:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-11 16:37:32 +0900 |
| commit | fbcba37940f27e9c22df0901e6b3b737c26b4369 (patch) | |
| tree | fcd1dc68b5dca03315abf0d16ff48c5deb6112f5 /crates/shirabe | |
| parent | 27d00055df8691a6bd99aaf38633a7338b16cc6a (diff) | |
| download | php-shirabe-fbcba37940f27e9c22df0901e6b3b737c26b4369.tar.gz php-shirabe-fbcba37940f27e9c22df0901e6b3b737c26b4369.tar.zst php-shirabe-fbcba37940f27e9c22df0901e6b3b737c26b4369.zip | |
fix(command-loader): return Rc<RefCell<dyn Command>> from get()
CommandLoaderInterface::get() returned Box<dyn Command>, which didn't
match the Rc<RefCell<dyn SymfonyCommand>> Application::add() expects,
leaving both call sites as todo!() panics.
Diffstat (limited to 'crates/shirabe')
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index a2f36cf4..1a38f118 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -826,15 +826,9 @@ impl Application { && command_loader.has(name) { let command = command_loader.get(name); - // $this->add($this->commandLoader->get($name)) - // TODO(review): command_loader.get() returns Box<dyn SymfonyCommand> while add() expects - // Rc<RefCell<dyn SymfonyCommand>>; the loader return type needs reconciliation. - let _ = command; return self .shared() - .add(todo!( - "std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>> from command_loader.get(name)" - )) + .add(command) .map(|c| c.is_some()) .unwrap_or(false); } @@ -1034,9 +1028,7 @@ impl Application { if commands.len() > 1 { // $commandList = commandLoader ? array_merge(array_flip(loader->getNames()), commands) : commands // TODO(review): $commandList mixes flipped loader names (string => int) with - // SymfonyCommand - // instances; this heterogeneous PHP array needs a typed representation. The alias - // de-duplication and the loader->get() lazy materialization are left to design. + // SymfonyCommand instances; this heterogeneous PHP array needs a typed representation. let mut command_list: IndexMap< String, std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>>, @@ -1048,13 +1040,7 @@ impl Application { for name_or_alias in commands { if !command_list.contains_key(&name_or_alias) { let loaded = self.command_loader.as_ref().unwrap().get(&name_or_alias); - let _ = loaded; - command_list.insert( - name_or_alias.clone(), - todo!( - "std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>> from command_loader.get(name_or_alias)" - ), - ); + command_list.insert(name_or_alias.clone(), loaded); } let command_name = command_list[&name_or_alias] |
