From 1c02496e8a42da6a7f538a48617b7cba1b8dc238 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 22 Mar 2024 01:50:16 +0700 Subject: [PATCH 1/2] chore: remove unnecessary if check --- system/HTTP/Negotiate.php | 2 +- system/Helpers/form_helper.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/system/HTTP/Negotiate.php b/system/HTTP/Negotiate.php index 9c903908695f..61c3a58f4af7 100644 --- a/system/HTTP/Negotiate.php +++ b/system/HTTP/Negotiate.php @@ -274,7 +274,7 @@ public function parseHeader(string $header): array protected function match(array $acceptable, string $supported, bool $enforceTypes = false, $matchLocales = false): bool { $supported = $this->parseHeader($supported); - if (is_array($supported) && count($supported) === 1) { + if (count($supported) === 1) { $supported = $supported[0]; } diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index 97ac2c2a8c5c..098222e90e9f 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -456,10 +456,8 @@ function form_label(string $labelText = '', string $id = '', array $attributes = $label .= ' for="' . $id . '"'; } - if (is_array($attributes) && $attributes) { - foreach ($attributes as $key => $val) { - $label .= ' ' . $key . '="' . $val . '"'; - } + foreach ($attributes as $key => $val) { + $label .= ' ' . $key . '="' . $val . '"'; } return $label . '>' . $labelText . ''; From 0d68bade9ec4ae7892ced718bbc4318d3b9c5684 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 22 Mar 2024 01:54:34 +0700 Subject: [PATCH 2/2] regenerate phsptan baseline --- phpstan-baseline.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index da28aa2fb3d5..7dfbce9094a9 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -6766,11 +6766,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/HTTP/MessageInterface.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Call to function is_array\\(\\) with array will always evaluate to true\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/HTTP/Negotiate.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\HTTP\\\\Negotiate\\:\\:charset\\(\\) has parameter \\$supported with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -7376,11 +7371,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Helpers/filesystem_helper.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Call to function is_array\\(\\) with array will always evaluate to true\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/form_helper.php', -]; $ignoreErrors[] = [ 'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#', 'count' => 1, @@ -7571,11 +7561,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Helpers/form_helper.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Only booleans are allowed in &&, array given on the right side\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/form_helper.php', -]; $ignoreErrors[] = [ 'message' => '#^Only booleans are allowed in a negated boolean, int\\<0, max\\> given\\.$#', 'count' => 1,