diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-08 01:54:56 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-08 01:54:56 +0900 |
| commit | 318ea948f5932dfa7942081a269d62fd7161a9bf (patch) | |
| tree | 0fff2fe818f87a20dea89a51901f9e16071f2f53 /crates/shirabe/src/command/base_command.rs | |
| parent | f232d7f9d2936ef84bd904cacd21c12cb7012b34 (diff) | |
| download | php-shirabe-318ea948f5932dfa7942081a269d62fd7161a9bf.tar.gz php-shirabe-318ea948f5932dfa7942081a269d62fd7161a9bf.tar.zst php-shirabe-318ea948f5932dfa7942081a269d62fd7161a9bf.zip | |
feat(phase-c): resolve reflection/downcast phase-b TODOs
Resolve category F phase-b TODOs (class-string, instanceof, get_class,
method_exists, __FILE__, Reflection API, downcast).
- VcsRepository: dispatch drivers through a VcsDriverKind enum
(instantiate/supports/php_class_name) and add constructors to the
concrete VCS drivers
- repository downcasts via RepositoryInterfaceHandle::downcast_rc and
as_any (init/show commands, vcs ValidatingArrayLoader)
- BaseCommand::is_self_update_command override replaces an instanceof
- Factory::create narrows PartialComposer to ComposerHandle via as_full
- InstalledVersions gains set_self_dir/set_installed_is_local_dir,
replacing Reflection-based static property mutation
- ClassLoader::as_array_iter ports the PHP (array) cast
- drop the unnecessary __FILE__ phar branch in self-update
application get_class(command) reclassified TODO(plugin); buffer_io
StreamableInputInterface downcast and the ValidatingArrayLoader trait
redesign left as tracked TODOs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/base_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/base_command.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs index 24b5a2b..d0818bf 100644 --- a/crates/shirabe/src/command/base_command.rs +++ b/crates/shirabe/src/command/base_command.rs @@ -279,6 +279,10 @@ pub trait HasBaseCommandData { fn io_mut(&mut self) -> &mut Option<Rc<RefCell<dyn IOInterface>>> { &mut self.base_command_data_mut().io } + + fn is_self_update_command(&self) -> bool { + false + } } impl<C: HasBaseCommandData> BaseCommand for C { @@ -352,7 +356,11 @@ impl<C: HasBaseCommandData> BaseCommand for C { .has_parameter_option(&["--no-scripts"], false); // TODO(phase-b): requires inner Symfony Application access for disable_plugins_by_default / disable_scripts_by_default - // TODO(phase-b): `$this instanceof SelfUpdateCommand` not representable + + if self.is_self_update_command() { + disable_plugins = true; + disable_scripts = true; + } let composer = self.try_composer(Some(disable_plugins), Some(disable_scripts)); let io = self.get_io(); @@ -503,7 +511,7 @@ impl<C: HasBaseCommandData> BaseCommand for C { }; // TODO(phase-b): Option<IndexMap<String, PhpMixed>> -> Option<LocalConfigInput> conversion let _ = config; - Factory::create(io, None, disable_plugins_kind, disable_scripts) + Factory::create(io, None, disable_plugins_kind, disable_scripts).map(|c| c.upcast()) } fn get_preferred_install_options( |
