From 596482de82ff32705e85f18c1c9ae784e6cd2c6f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 11:24:48 +0900 Subject: refactor(xdebug-handler): extract composer/xdebug_handler into the shirabe-xdebug-handler crate Move `Composer\XdebugHandler` out of shirabe-external-packages and into its own crate, so the path is `shirabe_xdebug_handler::XdebugHandler` instead of `shirabe_external_packages::composer::xdebug_handler::XdebugHandler`. Standing alone, the stub no longer sits in a crate that shirabe-php-rpc depends on, so drop the dependency-cycle rationale from the comments that explain why callers reach for shirabe_php_rpc directly. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-xdebug-handler/src/lib.rs | 3 ++ .../shirabe-xdebug-handler/src/xdebug_handler.rs | 32 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 crates/shirabe-xdebug-handler/src/lib.rs create mode 100644 crates/shirabe-xdebug-handler/src/xdebug_handler.rs (limited to 'crates/shirabe-xdebug-handler/src') diff --git a/crates/shirabe-xdebug-handler/src/lib.rs b/crates/shirabe-xdebug-handler/src/lib.rs new file mode 100644 index 00000000..c95f237d --- /dev/null +++ b/crates/shirabe-xdebug-handler/src/lib.rs @@ -0,0 +1,3 @@ +pub mod xdebug_handler; + +pub use xdebug_handler::*; diff --git a/crates/shirabe-xdebug-handler/src/xdebug_handler.rs b/crates/shirabe-xdebug-handler/src/xdebug_handler.rs new file mode 100644 index 00000000..6ccedc6a --- /dev/null +++ b/crates/shirabe-xdebug-handler/src/xdebug_handler.rs @@ -0,0 +1,32 @@ +//! ref: composer/vendor/composer/xdebug-handler/src/XdebugHandler.php + +#[derive(Debug)] +pub struct XdebugHandler; + +impl XdebugHandler { + pub fn is_xdebug_active() -> bool { + // TODO(php-runtime) + false + } + + pub fn get_skipped_version() -> Option { + // TODO(php-runtime) + // The restart-to-disable-xdebug mechanism is not ported (`is_xdebug_active` is + // hardcoded `false`), so a restart never happens and `self::$skipped` stays at + // its PHP default of `""`. + Some(String::new()) + } + + pub fn get_all_ini_files() -> Vec { + // TODO(php-runtime) + // No XdebugHandler is ever constructed (`self::$name` stays null), because the + // `new XdebugHandler('Composer'); $xdebug->check();` bootstrap in `bin/composer` is not + // ported (see the TODO(phase-c) at the top of shirabe's main.rs), so the + // COMPOSER_ORIGINAL_INIS env-var branch is unreachable here. + // + // Callers that need the real PHP runtime's ini files (php_ini_loaded_file() / + // php_ini_scanned_files()) query shirabe_php_rpc directly instead of going through this + // stub; see IniHelper::get_all in the shirabe crate. + vec![String::new()] + } +} -- cgit v1.3.1-4-g156e