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-class-map-generator/src/php_file_parser.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/shirabe-class-map-generator/src') diff --git a/crates/shirabe-class-map-generator/src/php_file_parser.rs b/crates/shirabe-class-map-generator/src/php_file_parser.rs index ac0c8f1c..f71b993a 100644 --- a/crates/shirabe-class-map-generator/src/php_file_parser.rs +++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs @@ -4,9 +4,8 @@ use crate::php_file_cleaner::PhpFileCleaner; use indexmap::IndexMap; use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ - CmpOp, HHVM_VERSION, PHP_EOL, PHP_VERSION_ID, RuntimeException, file_exists, file_get_contents, - function_exists, is_file, is_readable, ltrim, php_strip_whitespace, str_replace_array, strrpos, - substr, trim, version_compare, + PHP_EOL, PHP_VERSION_ID, RuntimeException, file_exists, file_get_contents, function_exists, + is_file, is_readable, ltrim, php_strip_whitespace, str_replace_array, strrpos, substr, trim, }; use std::sync::OnceLock; @@ -177,10 +176,10 @@ impl PhpFileParser { EXTRA_TYPES.get_or_init(|| { let mut extra_types = String::new(); let mut extra_types_array: Vec = vec![]; - if PHP_VERSION_ID >= 80100 - || (HHVM_VERSION.is_some() - && version_compare(HHVM_VERSION.unwrap(), "3.3", CmpOp::Ge)) - { + // TODO(php-runtime): whether `enum` is scanned for belongs to the runtime that loads + // the generated class map, i.e. the worker, while PHP_VERSION_ID is the version this + // build models. PHP also scans for enums on HHVM 3.3 and above. + if PHP_VERSION_ID >= 80100 { extra_types += "|enum"; extra_types_array = vec!["enum".to_string()]; } -- cgit v1.3.1-4-g156e