From e6cc7371d1685f648e52882568c8330373b6c090 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 24 Jul 2026 00:38:59 +0900 Subject: refactor(symfony-process): remove unused Process API surface Since Process is php-native with no Rust-fidelity obligation (see plugin-class-classification.md), this port only needs to cover what Rust-ported Composer code actually calls. Made the pipes/process_utils modules pub(crate) (nothing outside symfony/process used them) and rebuilt with `--force-warn dead_code` (normally allowed workspace-wide) to find genuinely unreachable methods: Process lost 17 methods, 5 constants, and a private clone helper; ExecutableFinder lost two unused suffix setters; AbstractPipes lost handle_error, whose only caller (a stream_select error-handler registration) was never wired up. Removing several of those setters (set_pty, set_idle_timeout, disable_output/enable_output, set_options) then left the fields they used to write with no remaining writer, so they hold one constant value on every reachable path: pty always false, idle_timeout always None, output_disabled always false, options always {suppress_errors, bypass_shell}. Audited by value (not just call-graph reachability) and removed everything that depended on the now-constant value: - pty: is_pty(), is_pty_supported(), the PTY descriptor branch in UnixPipes::get_descriptors(), and the now-unconstructed Descriptor::Pty variant in shirabe-php-shim (plus its proc_open match arm). - idle_timeout: get_idle_timeout() and check_timeout()'s idle branch; ProcessTimedOutException collapses to the single reachable timeout type (dropped timeout_type/TYPE_GENERAL/TYPE_IDLE/is_general_timeout/ is_idle_timeout/get_exceeded_timeout). - output_disabled: is_output_disabled(), build_callback()'s disabled variant, get_descriptors()'s output_disabled term, and the always-false guard in read_pipes_for_output()/ProcessFailedException (its output section is now unconditional). - options: Drop::drop()'s create_new_console branch can never fire (that key can no longer exist), so it always just stops the process. - has_callback/last_output_time: left write-only once their only readers (the branches above) were gone. - have_read_support: constant true once output_disabled collapsed, so removed from PipesInterface, UnixPipes (incl. its /dev/null null-stream branch), WindowsPipes, and Process::wait()'s dead guard. No behavior change: every removed item/branch had zero callers, or was constant on every reachable call site. --- .../src/symfony/process/executable_finder.rs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/process/executable_finder.rs') diff --git a/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs b/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs index 3396b29b..d4891af0 100644 --- a/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs +++ b/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs @@ -25,16 +25,6 @@ impl ExecutableFinder { Self { suffixes: vec![] } } - /// Replaces default suffixes of executable. - pub fn set_suffixes(&mut self, suffixes: Vec) { - self.suffixes = suffixes; - } - - /// Adds new possible suffix to check for executable. - pub fn add_suffix(&mut self, suffix: &str) { - self.suffixes.push(suffix.to_string()); - } - pub fn find(&self, name: &str, default: Option<&str>, extra_dirs: &[String]) -> Option { // windows built-in commands that are present in cmd.exe should not be resolved using PATH as they do not exist as exes if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" -- cgit v1.3.1