Skip to content

Commit 0aaeeeb

Browse files
authored
Use PHP 8.4 array helpers in Arr utils (laravel#56631)
1 parent 39e9e2b commit 0aaeeeb

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/Illuminate/Collections/Arr.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,7 @@ public static function hasAny($array, $keys)
557557
*/
558558
public static function every($array, callable $callback)
559559
{
560-
foreach ($array as $key => $value) {
561-
if (! $callback($value, $key)) {
562-
return false;
563-
}
564-
}
565-
566-
return true;
560+
return array_all($array, $callback);
567561
}
568562

569563
/**
@@ -575,13 +569,7 @@ public static function every($array, callable $callback)
575569
*/
576570
public static function some($array, callable $callback)
577571
{
578-
foreach ($array as $key => $value) {
579-
if ($callback($value, $key)) {
580-
return true;
581-
}
582-
}
583-
584-
return false;
572+
return array_any($array, $callback);
585573
}
586574

587575
/**

0 commit comments

Comments
 (0)