From a41b1f59fe13c65b0e164b8f753aabae0a6fa6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoran=20Lazi=C4=87?= Date: Thu, 18 Sep 2025 15:04:21 +0200 Subject: [PATCH] Refactor NodeValueFactory to handle PHP associative arrays as objects --- src/Value/DecodedJson/NodeValueFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Value/DecodedJson/NodeValueFactory.php b/src/Value/DecodedJson/NodeValueFactory.php index 33f7c15..2eb6209 100644 --- a/src/Value/DecodedJson/NodeValueFactory.php +++ b/src/Value/DecodedJson/NodeValueFactory.php @@ -29,8 +29,8 @@ public function createValue(mixed $data, ?PathInterface $path = null): NodeValue return match (true) { null === $data, is_scalar($data) => new NodeScalarValue($data, $path), + is_object($data) || (is_array($data) && !array_is_list($data)) => new NodeObjectValue((object)$data, $path, $this), is_array($data) => new NodeArrayValue($data, $path, $this), - is_object($data) => new NodeObjectValue($data, $path, $this), default => throw new Exception\InvalidNodeDataException($data, $path), }; }