diff --git a/src/AccessHelper.php b/src/AccessHelper.php index 28d8698..c8b0140 100644 --- a/src/AccessHelper.php +++ b/src/AccessHelper.php @@ -145,7 +145,7 @@ public static function unsetValue(mixed &$collection, $key): void /** * @throws JSONPathException */ - public static function arrayValues(array|ArrayAccess $collection): array|ArrayAccess + public static function arrayValues(array|object $collection): array|ArrayAccess { if (\is_array($collection)) { return \array_values($collection); diff --git a/src/Filters/RecursiveFilter.php b/src/Filters/RecursiveFilter.php index 7db554d..440b3ef 100644 --- a/src/Filters/RecursiveFilter.php +++ b/src/Filters/RecursiveFilter.php @@ -29,9 +29,9 @@ public function filter($collection): array /** * @throws JSONPathException */ - private function recurse(array &$result, array|ArrayAccess $data): void + private function recurse(array &$result, array|object $data): void { - $result[] = $data; + $result[] = (array)$data; if (AccessHelper::isCollectionType($data)) { foreach (AccessHelper::arrayValues($data) as $value) {