From 6a30f0f65b437c161b2f222b7b215054a085775e Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Sat, 3 Aug 2024 10:07:56 +0200 Subject: [PATCH] use isset instead of empty to handle 0 root --- src/Model/Document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Document.php b/src/Model/Document.php index 6ca49d5..295e1c3 100644 --- a/src/Model/Document.php +++ b/src/Model/Document.php @@ -206,7 +206,7 @@ public static function from(mixed $document): self if (is_array($document)) { if (isset($document['types'])) { $root = null; - if (!empty($document['root'])) { + if (isset($document['root'])) { $root = (int) $document['root']; } @@ -226,7 +226,7 @@ public static function from(mixed $document): self } } elseif ($document instanceof \stdClass) { $root = null; - if (!empty($document->root)) { + if (isset($document->root)) { $root = (int) $document->root; }