Skip to content

Commit 0a7d2e8

Browse files
committed
Refator dump #1230
1 parent 6388ce0 commit 0a7d2e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/RecordTrait.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Windwalker\Utilities\Classes\TraitHelper;
1212
use Windwalker\Utilities\TypeCast;
1313

14+
use function Windwalker\get_object_dump_values;
15+
1416
trait RecordTrait
1517
{
1618
public static function wrap(mixed $values, bool $clone = false): static
@@ -129,7 +131,7 @@ public function with(...$data): static
129131

130132
public function dump(bool $recursive = false, bool $onlyDumpable = false): array
131133
{
132-
return TypeCast::toArray(get_object_vars($this), $recursive, $onlyDumpable);
134+
return TypeCast::toArray(get_object_dump_values($this), $recursive, $onlyDumpable);
133135
}
134136

135137
/**
@@ -153,7 +155,7 @@ public function as(string $className): object
153155
*/
154156
public function jsonSerialize(): mixed
155157
{
156-
$item = get_object_vars($this);
158+
$item = $this->dump();
157159

158160
foreach ($item as $key => $value) {
159161
$prop = new \ReflectionProperty($this, $key);
@@ -165,7 +167,7 @@ public function jsonSerialize(): mixed
165167

166168
/** @var \ReflectionAttribute<JsonSerializerInterface> $attr */
167169
foreach ($attrs as $attr) {
168-
if ($attr instanceof JsonNoSerialize) {
170+
if (is_a($attr->getName(), JsonNoSerialize::class, true)) {
169171
unset($item[$key]);
170172
continue 2;
171173
}

0 commit comments

Comments
 (0)