File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1111use Windwalker \Utilities \Classes \TraitHelper ;
1212use Windwalker \Utilities \TypeCast ;
1313
14+ use function Windwalker \get_object_dump_values ;
15+
1416trait 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 }
You can’t perform that action at this time.
0 commit comments