Skip to content

Commit 3529f3f

Browse files
authored
If an object implements \ArrayAccess, check both array value and property
1 parent ac44145 commit 3529f3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Utils/Utils.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ public static function suggestionList(string $input, array $options): array
267267
*/
268268
public static function extractKey($objectLikeValue, string $key)
269269
{
270-
if (\is_array($objectLikeValue) || $objectLikeValue instanceof \ArrayAccess) {
270+
if (\is_array($objectLikeValue)) {
271271
return $objectLikeValue[$key] ?? null;
272272
}
273273

274+
if ($objectLikeValue instanceof \ArrayAccess) {
275+
return $objectLikeValue[$key] ?? $objectLikeValue->{$key} ?? null;
276+
}
277+
274278
if (\is_object($objectLikeValue)) {
275279
return $objectLikeValue->{$key} ?? null;
276280
}

0 commit comments

Comments
 (0)