From 7fd7df848cdbbd8792b0043799018d51408458fc Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 2 Jul 2026 05:12:39 +0900 Subject: feat(php-rpc): implement Runtime::has_constant/get_constant via php-rpc Runtime::hasConstant/getConstant need a real PHP interpreter's defined()/ constant() to answer platform requirement checks (e.g. PHP_ZTS, PHP_INT_SIZE), which the shim can't provide since Rust constants aren't queryable by string. Extend shirabe-php-rpc's protocol to carry one string argument and return the full PHP scalar range, add defined/constant dispatch entries to the worker, and wire Runtime and get_php_version/get_php_binary onto them. --- crates/shirabe/src/platform/runtime.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/platform/runtime.rs b/crates/shirabe/src/platform/runtime.rs index 255aa9d..e4ff64a 100644 --- a/crates/shirabe/src/platform/runtime.rs +++ b/crates/shirabe/src/platform/runtime.rs @@ -3,8 +3,8 @@ use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ - PhpMixed, class_exists, constant, defined, function_exists, get_loaded_extensions, - html_entity_decode, implode, instantiate_class, ltrim, phpversion, strip_tags, trim, + PhpMixed, class_exists, function_exists, get_loaded_extensions, html_entity_decode, implode, + instantiate_class, ltrim, phpversion, strip_tags, trim, }; /// Seam over the PHP runtime so PlatformRepository can be tested against mocked @@ -29,14 +29,14 @@ pub struct Runtime; impl RuntimeInterface for Runtime { fn has_constant(&self, constant_name: &str, class: Option) -> bool { - defined(<rim( + shirabe_php_rpc::has_constant(<rim( &format!("{}::{}", class.as_deref().unwrap_or(""), constant_name), Some(":"), )) } fn get_constant(&self, constant_name: &str, class: Option) -> PhpMixed { - constant(<rim( + shirabe_php_rpc::get_constant(<rim( &format!("{}::{}", class.as_deref().unwrap_or(""), constant_name), Some(":"), )) -- cgit v1.3.1