From 9d01ba229c3e6214670721270bbb7511f08d4ce9 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 23 Dec 2023 07:13:26 +0100 Subject: [PATCH] Refactor --- src/Snapshot.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Snapshot.php b/src/Snapshot.php index 8ee3fdb..2e611c6 100644 --- a/src/Snapshot.php +++ b/src/Snapshot.php @@ -12,8 +12,6 @@ use function array_keys; use function array_merge; use function array_reverse; -use function assert; -use function func_get_args; use function get_declared_classes; use function get_declared_interfaces; use function get_declared_traits; @@ -309,16 +307,8 @@ private function canBeSerialized(mixed $variable): bool return true; } - private function enumerateObjectsAndResources(mixed $variable): array + private function enumerateObjectsAndResources(mixed $variable, Context $processed = new Context): array { - if (isset(func_get_args()[1])) { - $processed = func_get_args()[1]; - } else { - $processed = new Context; - } - - assert($processed instanceof Context); - $result = []; if ($processed->contains($variable)) {