Skip to content

Commit e9000a4

Browse files
committed
Fix get object values
1 parent b8ea4a5 commit e9000a4

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/functions.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,17 @@ function get_object_dump_values(
560560
object $object,
561561
?int $filter = null
562562
): array {
563-
return array_map(
564-
static fn(\ReflectionProperty $prop) => $prop->getValue($object),
565-
get_object_dump_props(
566-
$object,
567-
$filter
568-
)
569-
);
563+
$props = get_object_dump_props($object, $filter);
564+
$vars = get_object_vars($object);
565+
566+
$values = array_intersect_key($vars, $props);
567+
$diffProps = array_diff_key($props, $vars);
568+
569+
foreach ($diffProps as $name => $prop) {
570+
$values[$name] = $prop->getValue($object);
571+
}
572+
573+
return $values;
570574
}
571575
}
572576
}

0 commit comments

Comments
 (0)