Skip to content

Commit 6503abc

Browse files
Merge branch '8.x'
2 parents 063154a + 3313bb9 commit 6503abc

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ public function sort($callback = null)
10861086

10871087
$callback && is_callable($callback)
10881088
? uasort($items, $callback)
1089-
: asort($items, $callback);
1089+
: asort($items, $callback ?? SORT_REGULAR);
10901090

10911091
return new static($items);
10921092
}

Enumerable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ public function whereNotIn($key, $values, $strict = false);
415415
public function whereNotInStrict($key, $values);
416416

417417
/**
418-
* Filter the items, removing any items that don't match the given type.
418+
* Filter the items, removing any items that don't match the given type(s).
419419
*
420-
* @param string $type
420+
* @param string|string[] $type
421421
* @return static
422422
*/
423423
public function whereInstanceOf($type);

Traits/EnumeratesValues.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -669,14 +669,24 @@ public function whereNotInStrict($key, $values)
669669
}
670670

671671
/**
672-
* Filter the items, removing any items that don't match the given type.
672+
* Filter the items, removing any items that don't match the given type(s).
673673
*
674-
* @param string $type
674+
* @param string|string[] $type
675675
* @return static
676676
*/
677677
public function whereInstanceOf($type)
678678
{
679679
return $this->filter(function ($value) use ($type) {
680+
if (is_array($type)) {
681+
foreach ($type as $classType) {
682+
if ($value instanceof $classType) {
683+
return true;
684+
}
685+
}
686+
687+
return false;
688+
}
689+
680690
return $value instanceof $type;
681691
});
682692
}

0 commit comments

Comments
 (0)