From 1446503322a23372ccf231d142581f8819faf8c8 Mon Sep 17 00:00:00 2001 From: agis Date: Fri, 31 Jul 2026 14:42:41 +0700 Subject: [PATCH 1/2] refactor: remove deprecated array_first/array_last helpers Use \Illuminate\Support\Arr::first()/Arr::last() instead. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Illuminate/Support/helpers.php | 36 ---------------------------- tests/Support/SupportHelpersTest.php | 13 ---------- 2 files changed, 49 deletions(-) diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 3fbc00b5..d2eb3329 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -168,42 +168,6 @@ function array_fetch($array, $key) } } -if ( ! function_exists('array_first')) -{ - /** - * Return the first element in an array passing a given truth test. - * - * @param array $array - * @param \Closure $callback - * @param mixed $default - * @return mixed - * - * @deprecated Use \Illuminate\Support\Arr::first() instead. - */ - function array_first($array, $callback, $default = null) - { - return Arr::first($array, $callback, $default); - } -} - -if ( ! function_exists('array_last')) -{ - /** - * Return the last element in an array passing a given truth test. - * - * @param array $array - * @param \Closure $callback - * @param mixed $default - * @return mixed - * - * @deprecated Use \Illuminate\Support\Arr::last() instead. - */ - function array_last($array, $callback, $default = null) - { - return Arr::last($array, $callback, $default); - } -} - if ( ! function_exists('array_flatten')) { /** diff --git a/tests/Support/SupportHelpersTest.php b/tests/Support/SupportHelpersTest.php index 15bd08e0..8b2f2199 100755 --- a/tests/Support/SupportHelpersTest.php +++ b/tests/Support/SupportHelpersTest.php @@ -101,19 +101,6 @@ public function testArrayDivide() } - public function testArrayFirst() - { - $array = ['name' => 'taylor', 'otherDeveloper' => 'dayle']; - $this->assertEquals('dayle', array_first($array, function($value, $key) { return $value == 'dayle'; })); - } - - public function testArrayLast() - { - $array = [100, 250, 290, 320, 500, 560, 670]; - $this->assertEquals(670, array_last($array, function($value, $key) { return $value > 320; })); - } - - public function testArrayFetch() { $data = [ From 6ceabec5f3daac35aea1eaf8f8fc176b1f530b8f Mon Sep 17 00:00:00 2001 From: agis Date: Fri, 31 Jul 2026 14:44:23 +0700 Subject: [PATCH 2/2] chore: gitignore .serena Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 68eee822..24f67319 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ Thumbs.db .phpunit.result.cache .direnv .envrc -.devenv \ No newline at end of file +.devenv.serena/