From 913ab5b38ca7526f93a889685671a84de7657907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D1=96=D0=B9?= <61122611+CrazyTapok-bit@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:27:13 +0200 Subject: [PATCH] Improved Arrayable --- src/Support/Arrayable.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Support/Arrayable.php b/src/Support/Arrayable.php index e32e05d..da2c6d9 100644 --- a/src/Support/Arrayable.php +++ b/src/Support/Arrayable.php @@ -4,7 +4,6 @@ use ReflectionClass; use ReflectionProperty; -use TgWebValid\Make\Make; abstract class Arrayable { @@ -26,10 +25,9 @@ public function toArray(?object $object = null): array foreach ($properties as $property) { $name = $property->getName(); $value = $object->$name ?? null; - $result[$name] = match(true) { - $value instanceof Make => $this->toArray($value), - default => $value - }; + $result[$name] = $value instanceof self + ? $this->toArray($value) + : $value; } return $result;