aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/diagnose_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-29 00:16:56 +0900
committernsfisis <nsfisis@gmail.com>2026-05-29 00:23:32 +0900
commit7f83e785a77fbdbcada9c6714703d4e5801af82a (patch)
treeef7debc5cbc91d521db4dc5a563807c486dafd22 /crates/shirabe/src/command/diagnose_command.rs
parent7715c98aaf3e3962cabbcf740e93fa817a2f8027 (diff)
downloadphp-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.tar.gz
php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.tar.zst
php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.zip
refactor(io): unify IOInterface params to Rc<RefCell<dyn _>>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/diagnose_command.rs')
-rw-r--r--crates/shirabe/src/command/diagnose_command.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs
index 945d1e9..bcedf30 100644
--- a/crates/shirabe/src/command/diagnose_command.rs
+++ b/crates/shirabe/src/command/diagnose_command.rs
@@ -79,7 +79,7 @@ impl DiagnoseCommand {
output: &dyn OutputInterface,
) -> anyhow::Result<i64> {
let mut composer = self.try_composer(None, None);
- let io_boxed: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = self.get_io().clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = self.get_io().clone();
let config: std::rc::Rc<std::cell::RefCell<Config>>;
if let Some(ref mut c) = composer {
@@ -104,7 +104,7 @@ impl DiagnoseCommand {
.map(std::rc::Rc::clone)
.unwrap_or_else(|| {
std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
- io_boxed.clone(),
+ io.clone(),
))))
}),
);
@@ -112,14 +112,9 @@ impl DiagnoseCommand {
config = std::rc::Rc::new(std::cell::RefCell::new(Factory::create_config(None, None)?));
self.process = Some(std::rc::Rc::new(std::cell::RefCell::new(
- ProcessExecutor::new(Some(io_boxed.clone())),
+ ProcessExecutor::new(Some(io.clone())),
)));
}
- // TODO(phase-b): clone_box to release self borrow held by get_io.
- let io_box = self.get_io().clone();
- let io_ref = io_box.borrow();
- let io: &dyn IOInterface = &*io_ref;
-
let mut config_inner: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
config_inner.insert("secure-http".to_string(), Box::new(PhpMixed::Bool(false)));
let mut secure_http_wrap: IndexMap<String, PhpMixed> = IndexMap::new();
@@ -130,12 +125,12 @@ impl DiagnoseCommand {
.merge(&secure_http_wrap, Config::SOURCE_COMMAND);
let _ = config.borrow_mut().prohibit_url_by_config(
"http://repo.packagist.org",
- Some(&NullIO::new()),
+ Some(std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))),
&IndexMap::new(),
);
self.http_downloader = Some(std::rc::Rc::new(std::cell::RefCell::new(
- Factory::create_http_downloader(io_box.clone(), &config, indexmap::IndexMap::new())?,
+ Factory::create_http_downloader(io.clone(), &config, indexmap::IndexMap::new())?,
)));
if strpos(file!(), "phar:") == Some(0) {