fix(transformers): force object type for properties (#4544)

This commit is contained in:
Devonte W 2022-11-21 20:28:46 +00:00 committed by GitHub
parent c3521e0221
commit 634c9353e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,10 +47,10 @@ class ActivityLogTransformer extends BaseClientTransformer
* Transforms any array values in the properties into a countable field for easier * Transforms any array values in the properties into a countable field for easier
* use within the translation outputs. * use within the translation outputs.
*/ */
protected function properties(ActivityLog $model): array protected function properties(ActivityLog $model): object
{ {
if (!$model->properties || $model->properties->isEmpty()) { if (!$model->properties || $model->properties->isEmpty()) {
return []; return (object) [];
} }
$properties = $model->properties $properties = $model->properties
@ -76,7 +76,7 @@ class ActivityLogTransformer extends BaseClientTransformer
$properties = $properties->merge(['count' => $properties->get($keys[0])])->except($keys[0]); $properties = $properties->merge(['count' => $properties->get($keys[0])])->except($keys[0]);
} }
return $properties->toArray(); return (object) $properties->toArray();
} }
/** /**