From 8313c66b5b07e7b8af8db8faa044a0b3a1783fa1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 20 Jun 2026 14:53:23 +0900 Subject: feat(php-shim): implement is_numeric Was a todo!() that panicked when ProcessExecutor::reset_max_jobs probed COMPOSER_MAX_PARALLEL_PROCESSES (archive, diagnose, init, ...). Ints and floats are numeric; strings delegate to the existing is_numeric_string, which agrees with PHP across the tested vectors. Booleans, null and arrays are not numeric. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe-php-shim/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/shirabe-php-shim') diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 381a56a..4b2ea87 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -468,8 +468,12 @@ pub fn is_scalar(_value: &PhpMixed) -> bool { ) } -pub fn is_numeric(_value: &PhpMixed) -> bool { - todo!() +pub fn is_numeric(value: &PhpMixed) -> bool { + match value { + PhpMixed::Int(_) | PhpMixed::Float(_) => true, + PhpMixed::String(s) => is_numeric_string(s), + _ => false, + } } pub fn strtotime(_time: &str) -> Option { -- cgit v1.3.1