aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-24 21:07:26 +0900
committernsfisis <nsfisis@gmail.com>2026-08-24 21:07:26 +0900
commit20f9787cda5b846c730cff97a4c7a3777ff3414a (patch)
tree2110607ee9842fa5288665bba56b03020057f432 /crates/shirabe/src/command
parent8cf8c04ab9b5a1f5bc7a8eb3230698f07fb7c204 (diff)
downloadphp-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.tar.gz
php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.tar.zst
php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.zip
refactor(silencer): stop guarding work that stays inside Rust
Silencer only lowers the PHP error_reporting() level and re-throws whatever the guarded work raises. A region that never reaches the PHP runtime has no level to lower and emits no diagnostic on failure, so wrapping it is indistinguishable from running it unguarded. The pair kept in Application::hint_common_errors brackets a getComposer() call, which loads installed plugins and dispatches PluginEvents::INIT. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command')
-rw-r--r--crates/shirabe/src/command/base_config_command.rs6
-rw-r--r--crates/shirabe/src/command/bump_command.rs8
-rw-r--r--crates/shirabe/src/command/config_command.rs6
-rw-r--r--crates/shirabe/src/command/init_command.rs7
4 files changed, 4 insertions, 23 deletions
diff --git a/crates/shirabe/src/command/base_config_command.rs b/crates/shirabe/src/command/base_config_command.rs
index 3be49394..4ffbfadd 100644
--- a/crates/shirabe/src/command/base_config_command.rs
+++ b/crates/shirabe/src/command/base_config_command.rs
@@ -7,7 +7,6 @@ use crate::config::JsonConfigSource;
use crate::factory::Factory;
use crate::json::JsonFile;
use crate::util::Platform;
-use crate::util::Silencer;
use indexmap::IndexMap;
use shirabe_php_shim::{PhpMixed, chmod, touch};
use shirabe_symfony_console::input::InputInterface;
@@ -93,10 +92,7 @@ pub trait BaseConfigCommand: BaseCommand {
m.insert("config".to_string(), PhpMixed::Object(IndexMap::new()));
m
}))?;
- let _ = Silencer::call(|| {
- chmod(&path, 0o600);
- Ok(())
- });
+ chmod(&path, 0o600);
}
if !self.config_file().unwrap().borrow().exists() {
diff --git a/crates/shirabe/src/command/bump_command.rs b/crates/shirabe/src/command/bump_command.rs
index 9639cbe9..61d153ab 100644
--- a/crates/shirabe/src/command/bump_command.rs
+++ b/crates/shirabe/src/command/bump_command.rs
@@ -15,7 +15,6 @@ use crate::package::base_package;
use crate::package::version::VersionBumper;
use crate::repository::PlatformRepository;
use crate::util::Filesystem;
-use crate::util::Silencer;
use shirabe_php_shim::{
PhpMixed, file_get_contents, file_put_contents, impl_php_class, is_writable, php_regex,
preg_is_match, preg_replace, strtolower,
@@ -85,12 +84,7 @@ impl BumpCommand {
};
if !is_writable(&composer_json_path)
- && Silencer::call(|| {
- file_put_contents(&composer_json_path, &contents)
- .map(|_| ())
- .ok_or_else(|| anyhow::anyhow!("file_put_contents failed"))
- })
- .is_err()
+ && file_put_contents(&composer_json_path, &contents).is_none()
{
io.write_error3(
&format!("<error>{} is not writable.</error>", composer_json_path),
diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs
index 2f3c5fd7..6c7e62f1 100644
--- a/crates/shirabe/src/command/config_command.rs
+++ b/crates/shirabe/src/command/config_command.rs
@@ -16,7 +16,6 @@ use crate::json::JsonFile;
use crate::package::base_package::{self};
use crate::util::Filesystem;
use crate::util::Platform;
-use crate::util::Silencer;
use indexmap::IndexMap;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, array_is_list, array_merge,
@@ -530,10 +529,7 @@ impl Command for ConfigCommand {
.borrow()
.write(PhpMixed::Array(empty_objs))?;
let path_clone = auth_config_file.borrow().get_path().to_string();
- Silencer::call(|| {
- shirabe_php_shim::chmod(&path_clone, 0o600);
- Ok(())
- });
+ shirabe_php_shim::chmod(&path_clone, 0o600);
}
Ok(())
}
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs
index 67530008..73285d62 100644
--- a/crates/shirabe/src/command/init_command.rs
+++ b/crates/shirabe/src/command/init_command.rs
@@ -17,7 +17,6 @@ use crate::repository::PlatformRepositoryHandle;
use crate::repository::RepositoryFactory;
use crate::util::Filesystem;
use crate::util::ProcessExecutor;
-use crate::util::Silencer;
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
@@ -675,11 +674,7 @@ impl Command for InitCommand {
true,
io_interface::NORMAL,
);
- let path_to_unlink = file_obj.get_path().to_string();
- let _ = Silencer::call(|| {
- shirabe_php_shim::unlink(&path_to_unlink);
- Ok::<(), anyhow::Error>(())
- });
+ let _ = shirabe_php_shim::unlink(file_obj.get_path());
return Ok(1);
}