aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src/array.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 18:49:24 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 18:52:05 +0900
commita3171eefd8f8e520329bdd8f613e83ba6f0a7c13 (patch)
tree195599a0c46b97349f017b97e965e4b4c1794f36 /crates/shirabe-php-shim/src/array.rs
parente24bf7e3b6b16a77c2eaeae9ba7b453f5138ff25 (diff)
downloadphp-shirabe-a3171eefd8f8e520329bdd8f613e83ba6f0a7c13.tar.gz
php-shirabe-a3171eefd8f8e520329bdd8f613e83ba6f0a7c13.tar.zst
php-shirabe-a3171eefd8f8e520329bdd8f613e83ba6f0a7c13.zip
refactor(php-shim): remove ArrayObject, inline IndexMap into PhpMixed::Object
ArrayObject was only a thin wrapper around IndexMap<String, PhpMixed> used as an empty-{} vs empty-[] marker and as the assoc=false JSON object representation; no reference semantics were involved. Inline its payload directly into PhpMixed::Object and drop the type along with the now-dead StdClass. Side effects of the unification: - ArrayObject::new was todo!(); the config --global / object-typed get paths that built PhpMixed::Object(ArrayObject::new(None)) no longer panic. - base_config_command wrote 'config' as PhpMixed::Array(empty), emitting [] instead of {}; now matches PHP's new \ArrayObject ({}). - The dead is::<StdClass>()/is::<ArrayObject>() instanceof checks in JsonManipulator are replaced with the faithful as_object() mapping. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src/array.rs')
-rw-r--r--crates/shirabe-php-shim/src/array.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/shirabe-php-shim/src/array.rs b/crates/shirabe-php-shim/src/array.rs
index 4b3e160..8c1988d 100644
--- a/crates/shirabe-php-shim/src/array.rs
+++ b/crates/shirabe-php-shim/src/array.rs
@@ -568,7 +568,7 @@ pub fn count(value: &PhpMixed) -> usize {
match value {
PhpMixed::List(items) => items.len(),
PhpMixed::Array(entries) => entries.len(),
- PhpMixed::Object(object) => object.count(),
+ PhpMixed::Object(object) => object.len(),
// PHP 8 throws a `TypeError` for non-countable arguments.
PhpMixed::Null
| PhpMixed::Bool(_)