From 7bacf187347d4a4b6dfaccfb29b9f777b3cccd86 Mon Sep 17 00:00:00 2001 From: gggeek Date: Wed, 18 Jan 2023 17:29:28 +0000 Subject: [PATCH] make addScalar friendlier to subclassing --- src/Value.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Value.php b/src/Value.php index 8aebe354..03a81084 100644 --- a/src/Value.php +++ b/src/Value.php @@ -177,7 +177,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess return 0; case 2: // we're adding a scalar value to an array here - $this->me['array'][] = new Value($val, $type); + $class = get_class($this); + $this->me['array'][] = new $class($val, $type); return 1; default: -- 2.47.0