From daa1acf091627f4f1af63ad44eee988048fa4136 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 11 Aug 2026 23:52:28 +0900 Subject: chore(php-shim): drop the HHVM_VERSION constant The constant was None and defined("HHVM_VERSION") reports it undefined, so every branch guarded by it was dead: shirabe is a Rust binary and never runs on HHVM. HhvmDetector keeps probing for an `hhvm` binary in PATH, which is what actually produces the hhvm platform package. Two of the dropped branches ask about the PHP runtime that consumes the result rather than about shirabe itself -- the class loader's Hack file lookup and the class map parser's enum scanning -- so both get a TODO(php-runtime) marker. --- crates/shirabe/src/autoload/class_loader.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/autoload') diff --git a/crates/shirabe/src/autoload/class_loader.rs b/crates/shirabe/src/autoload/class_loader.rs index 2d888ecf..de03201a 100644 --- a/crates/shirabe/src/autoload/class_loader.rs +++ b/crates/shirabe/src/autoload/class_loader.rs @@ -3,7 +3,7 @@ use indexmap::IndexMap; use shirabe_php_rpc::stream_resolve_include_path; use shirabe_php_shim::{ - InvalidArgumentException, PhpMixed, defined, file_exists, include_file, spl_autoload_register, + InvalidArgumentException, PhpMixed, file_exists, include_file, spl_autoload_register, spl_autoload_unregister, strlen, strpos, strrpos, strtr, substr, }; use std::sync::{LazyLock, Mutex}; @@ -340,12 +340,10 @@ impl ClassLoader { // No-op; APCu is not available in Rust. } - let mut file = self.find_file_with_extension(class, ".php"); - - // Search for Hack files if we are running on HHVM - if file.is_none() && defined("HHVM_VERSION") { - file = self.find_file_with_extension(class, ".hh"); - } + // TODO(php-runtime): PHP also looks for a Hack file (`.hh`) when it runs on HHVM. Only the + // worker, which is the runtime that includes the file, can answer whether it is HHVM, and + // asking boots it, while this lookup is what decides whether it is needed at all. + let file = self.find_file_with_extension(class, ".php"); if let Some(apcu_prefix) = &self.apcu_prefix { // No-op; APCu is not available in Rust. -- cgit v1.3.1-4-g156e