File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ public function pluck(string $key): ArrayList
289
289
{
290
290
return new ArrayList (function () use ($ key ) {
291
291
foreach ($ this as $ value ) {
292
- if (is_array ($ value ) && array_key_exists ($ key , $ value )) {
292
+ if (( is_array ($ value ) && array_key_exists ($ key , $ value)) || ( $ value instanceof ArrayAccess && $ value -> offsetExists ( $ key ) )) {
293
293
yield $ value [$ key ];
294
294
} elseif (is_object ($ value ) && property_exists ($ value , $ key )) {
295
295
yield $ value ->$ key ;
@@ -309,7 +309,7 @@ public function keyBy(string $key): Map
309
309
{
310
310
return new Map (function () use ($ key ) {
311
311
foreach ($ this as $ value ) {
312
- if (is_array ($ value ) && array_key_exists ($ key , $ value ) && $ this ->isStringable ($ value [$ key ])) {
312
+ if ((( is_array ($ value ) && array_key_exists ($ key , $ value)) || ( $ value instanceof ArrayAccess && $ value -> offsetExists ( $ key )) ) && $ this ->isStringable ($ value [$ key ])) {
313
313
yield $ value [$ key ] => $ value ;
314
314
} elseif (is_object ($ value ) && property_exists ($ value , $ key ) && $ this ->isStringable ($ value ->$ key )) {
315
315
yield $ value ->$ key => $ value ;
You can’t perform that action at this time.
0 commit comments