aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-04 03:20:05 +0900
committernsfisis <nsfisis@gmail.com>2026-07-04 16:58:29 +0900
commitd94e3ec276cb2fd344b6243cdbe5a5c9f3c3613a (patch)
treed81e10d5fbaf31e2a7bbbcf7cf1b18999285c675 /crates
parent3ec1d7d77ee6e41aaee74c4be855a86019e7256e (diff)
downloadphp-shirabe-d94e3ec276cb2fd344b6243cdbe5a5c9f3c3613a.tar.gz
php-shirabe-d94e3ec276cb2fd344b6243cdbe5a5c9f3c3613a.tar.zst
php-shirabe-d94e3ec276cb2fd344b6243cdbe5a5c9f3c3613a.zip
fix(create-project-command): split chained config.borrow_mut() calls
install_project's fluent builder chain called config.borrow_mut() four times inline as method arguments. Rust extends every argument temporary's lifetime to the end of the enclosing statement, so the first borrow_mut() was still alive when the second one ran, panicking with "already borrowed". Compute each value into a local before the chain instead, matching the pattern already used in install/update/require/remove_command.rs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe/src/command/create_project_command.rs46
1 files changed, 21 insertions, 25 deletions
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs
index e63502a..755590f 100644
--- a/crates/shirabe/src/command/create_project_command.rs
+++ b/crates/shirabe/src/command/create_project_command.rs
@@ -458,6 +458,23 @@ impl CreateProjectCommand {
.borrow_mut()
.set_output_progress(!no_progress);
+ let optimize_autoloader = config
+ .borrow()
+ .get("optimize-autoloader")
+ .as_bool()
+ .unwrap_or(false);
+ let class_map_authoritative = config
+ .borrow()
+ .get("classmap-authoritative")
+ .as_bool()
+ .unwrap_or(false);
+ let apcu_autoloader = config
+ .borrow()
+ .get("apcu-autoloader")
+ .as_bool()
+ .unwrap_or(false);
+ let audit_config = self.create_audit_config(&mut config.borrow_mut(), input.clone())?;
+
let mut installer = Installer::create(io.clone(), &composer_handle);
installer
.set_prefer_source(prefer_source)
@@ -471,31 +488,10 @@ impl CreateProjectCommand {
.unwrap()
.clone(),
)
- .set_optimize_autoloader(
- config
- .borrow_mut()
- .get("optimize-autoloader")
- .as_bool()
- .unwrap_or(false),
- )
- .set_class_map_authoritative(
- config
- .borrow_mut()
- .get("classmap-authoritative")
- .as_bool()
- .unwrap_or(false),
- )
- .set_apcu_autoloader(
- config
- .borrow_mut()
- .get("apcu-autoloader")
- .as_bool()
- .unwrap_or(false),
- None,
- )
- .set_audit_config(
- self.create_audit_config(&mut config.borrow_mut(), input.clone())?,
- );
+ .set_optimize_autoloader(optimize_autoloader)
+ .set_class_map_authoritative(class_map_authoritative)
+ .set_apcu_autoloader(apcu_autoloader, None)
+ .set_audit_config(audit_config);
if !composer.get_locker().borrow_mut().is_locked() {
installer.set_update(true);