From 791ef1cd465597ff43dab4216c4b00e9e4160da8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 06:25:10 +0900 Subject: refactor(php-shim): split in_array into strict and loose variants --- crates/shirabe-php-shim/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/shirabe-php-shim/src/lib.rs') diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 62287c23..7d22633c 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -209,6 +209,16 @@ impl PhpMixed { } } + /// Values of an array in insertion order. Panics on non-array values, mirroring the TypeError + /// PHP raises when an array is expected. + pub fn values(&self) -> Vec<&PhpMixed> { + match self { + PhpMixed::List(l) => l.iter().collect(), + PhpMixed::Array(a) | PhpMixed::Object(a) => a.values().collect(), + other => panic!("expected an array, got {:?}", other), + } + } + pub fn is_null(&self) -> bool { matches!(self, PhpMixed::Null) } -- cgit v1.3.1