From 507c42e57d899178cd3bc32f762ce7ad72d2e3a1 Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Thu, 17 Aug 2023 15:56:59 -0400 Subject: [PATCH] Change getData() so that it can be mixed instead of array The constructor itself allows $data to be mixed and the functions in AccessHelper has various conditional statements to process the data depending on whether it is an array or an implementation of ArrayAccess. However, getData() is explicitly typed to return an array which means any attempts to get the source object after creating a JSONPath of it will cause a TypeError to be raised. Changing getData() to return mixed instead of array will help fix this inconsistency. Signed-off-by: Remy Suen --- src/JSONPath.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JSONPath.php b/src/JSONPath.php index 2e28736..f91cc93 100644 --- a/src/JSONPath.php +++ b/src/JSONPath.php @@ -138,7 +138,7 @@ public function parseTokens(string $expression): array return $tokens; } - public function getData(): array + public function getData(): mixed { return $this->data; }