Skip to content

Commit

Permalink
Change getData() so that it can be mixed instead of array
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rcjsuen committed Aug 17, 2023
1 parent 3a6108a commit 507c42e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JSONPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function parseTokens(string $expression): array
return $tokens;
}

public function getData(): array
public function getData(): mixed
{
return $this->data;
}
Expand Down

0 comments on commit 507c42e

Please sign in to comment.