aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-14 14:05:35 +0900
committernsfisis <nsfisis@gmail.com>2026-06-14 14:05:35 +0900
commitdb7f5bd91c9d43d2d0b66824ed60571f1c478422 (patch)
treef2d4242c1a376a8fe9e513b3bcd05495cdc70881 /crates/shirabe/src/command
parente8e4794efb324bbdd2f29805e7a96cf1ee1616a8 (diff)
downloadphp-shirabe-db7f5bd91c9d43d2d0b66824ed60571f1c478422.tar.gz
php-shirabe-db7f5bd91c9d43d2d0b66824ed60571f1c478422.tar.zst
php-shirabe-db7f5bd91c9d43d2d0b66824ed60571f1c478422.zip
fix(command): resolve infinite recursion in command initialize
ConfigCommand/InitCommand::initialize called self.initialize, which resolved to the inherent method itself instead of the inherited BaseCommand::initialize (PHP's parent::initialize), recursing forever. Disambiguate to the trait method. CreateProjectCommand's create_composer_instance/create_audit_config were pure pass-through wrappers that PHP does not override; they recursed into themselves. Remove them so calls resolve to the inherited BaseCommand trait methods (the create_audit_config wrapper also had a &Config vs &mut Config signature mismatch). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command')
-rw-r--r--crates/shirabe/src/command/config_command.rs2
-rw-r--r--crates/shirabe/src/command/create_project_command.rs20
-rw-r--r--crates/shirabe/src/command/init_command.rs2
3 files changed, 2 insertions, 22 deletions
diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs
index 522a9e9..e055fee 100644
--- a/crates/shirabe/src/command/config_command.rs
+++ b/crates/shirabe/src/command/config_command.rs
@@ -123,7 +123,7 @@ impl ConfigCommand {
input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
- self.initialize(input.clone(), output)?;
+ BaseCommand::initialize(self, input.clone(), output)?;
let auth_config_file =
self.get_auth_config_file(input.clone(), &*self.config.as_ref().unwrap().borrow())?;
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs
index 5579a87..15a64df 100644
--- a/crates/shirabe/src/command/create_project_command.rs
+++ b/crates/shirabe/src/command/create_project_command.rs
@@ -995,26 +995,6 @@ impl CreateProjectCommand {
Ok(installed_from_vcs)
}
-
- // helpers reachable via $this in PHP, defined on BaseCommand here
- fn create_composer_instance(
- &self,
- input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
- io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
- config: Option<indexmap::IndexMap<String, PhpMixed>>,
- disable_plugins: bool,
- disable_scripts: Option<bool>,
- ) -> Result<PartialComposerHandle> {
- self.create_composer_instance(input, io, config, disable_plugins, disable_scripts)
- }
-
- fn create_audit_config(
- &self,
- config: &Config,
- input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
- ) -> Result<crate::advisory::AuditConfig> {
- self.create_audit_config(config, input)
- }
}
impl HasBaseCommandData for CreateProjectCommand {
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs
index b41492d..13d5809 100644
--- a/crates/shirabe/src/command/init_command.rs
+++ b/crates/shirabe/src/command/init_command.rs
@@ -421,7 +421,7 @@ impl InitCommand {
input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
- self.initialize(input.clone(), output)?;
+ BaseCommand::initialize(self, input.clone(), output)?;
if !input.borrow().is_interactive() {
if input.borrow().get_option("name")?.is_null() {