From 8bd750fddce4cccd8524e4d959b8b07f5a64ede8 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Thu, 6 Oct 2022 21:38:46 +0700 Subject: [PATCH 1/3] fix: phpstan error in v1.8.8 --- system/Helpers/array_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index 5a72efed67d3..f17809c09790 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -48,7 +48,7 @@ function _array_search_dot(array $indexes, array $array) // Grab the current index $currentIndex = $indexes ? array_shift($indexes) : null; - if ((empty($currentIndex) && (int) $currentIndex !== 0) || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { + if (empty($currentIndex) || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { return null; } From a40f7a5aa7aade979bf76861204b4524b1845cde Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 6 Oct 2022 22:06:51 +0700 Subject: [PATCH 2/3] fix: phpstan analyze error in array_helper --- system/Helpers/array_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index f17809c09790..d827cfeb826b 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -48,7 +48,7 @@ function _array_search_dot(array $indexes, array $array) // Grab the current index $currentIndex = $indexes ? array_shift($indexes) : null; - if (empty($currentIndex) || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { + if (empty($currentIndex) || (int) $currentIndex !== 0 || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { return null; } From 0ad1683ebdeac968fb7650c63551caf20bbe5816 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 6 Oct 2022 23:07:51 +0700 Subject: [PATCH 3/3] fix: phpstan analyze error in array_helper --- system/Helpers/array_helper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index d827cfeb826b..e4408bc60368 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -46,9 +46,10 @@ function dot_array_search(string $index, array $array) function _array_search_dot(array $indexes, array $array) { // Grab the current index - $currentIndex = $indexes ? array_shift($indexes) : null; + $currentIndex = $indexes ? array_shift($indexes) : null; + $intCurrentIndex = (int) $currentIndex; - if (empty($currentIndex) || (int) $currentIndex !== 0 || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { + if (empty($currentIndex) && $intCurrentIndex !== 0 || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { return null; }