From 7e8ebbcda98516e91526b7749f61634b48437c14 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:02:44 +0700 Subject: [PATCH 1/5] docs: @param BaseBuilder.php --- system/Database/BaseBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 1f0807cdbbde..62916eeaa63b 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2865,7 +2865,7 @@ public function deleteBatch($set = null, $constraints = null, int $batchSize = 1 * * @param string $table Protected table name * @param list $keys QBKeys - * @paramst> $values QBSet + * @param list $values QBSet */ protected function _deleteBatch(string $table, array $keys, array $values): string { From 590793e139ea326e79659319adfa5bbf7b91727e Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 19 Apr 2024 17:41:32 +0700 Subject: [PATCH 2/5] docs: specify phpdoc BaseBuilder --- phpstan-baseline.php | 98 +++++---------------------------- system/Database/BaseBuilder.php | 14 +++-- 2 files changed, 23 insertions(+), 89 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index caaad61d6e84..a7f3f149999b 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1791,36 +1791,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_insert\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_insert\\(\\) has parameter \\$unescapedKeys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_like\\(\\) has parameter \\$field with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -2206,6 +2181,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:\\$QBFrom type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3121,21 +3101,6 @@ 'count' => 3, 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3156,6 +3121,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', +]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:\\$randomKeyword type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3317,27 +3287,17 @@ 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_insert\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_insert\\(\\) has parameter \\$unescapedKeys with no value type specified in iterable type array\\.$#', + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:replace\\(\\) has parameter \\$set with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:replace\\(\\) has parameter \\$set with no value type specified in iterable type array\\.$#', + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; @@ -3676,26 +3636,6 @@ 'count' => 9, 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_insert\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_insert\\(\\) has parameter \\$unescapedKeys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3907,17 +3847,7 @@ 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Builder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Builder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Builder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', ]; diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 62916eeaa63b..4c80edc0aa39 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2376,7 +2376,9 @@ protected function validateInsert(): bool /** * Generates a platform-specific insert string from the supplied data * - * @param string $table Protected table name + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list $unescapedKeys QBSet */ protected function _insert(string $table, array $keys, array $unescapedKeys): string { @@ -2416,7 +2418,9 @@ public function replace(?array $set = null) /** * Generates a platform-specific replace string from the supplied data * - * @param string $table Protected table name + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list $values QBSet */ protected function _replace(string $table, array $keys, array $values): string { @@ -2863,9 +2867,9 @@ public function deleteBatch($set = null, $constraints = null, int $batchSize = 1 * * @used-by batchExecute() * - * @param string $table Protected table name - * @param list $keys QBKeys - * @param list $values QBSet + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list $values QBSet */ protected function _deleteBatch(string $table, array $keys, array $values): string { From abfb7f6a2d3ffec3d33875abce76684753b6c372 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Mon, 22 Apr 2024 09:23:24 +0700 Subject: [PATCH 3/5] docs: generate baseline --- phpstan-baseline.php | 20 -------------------- system/Database/BaseBuilder.php | 11 ++++++----- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index a7f3f149999b..3260e4b6f8cb 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1796,11 +1796,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_whereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', 'count' => 1, @@ -3101,11 +3096,6 @@ 'count' => 3, 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:fieldsFromQuery\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3286,11 +3276,6 @@ 'count' => 7, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:replace\\(\\) has parameter \\$set with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3636,11 +3621,6 @@ 'count' => 9, 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:fieldsFromQuery\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 4c80edc0aa39..d552580703ec 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2377,8 +2377,8 @@ protected function validateInsert(): bool * Generates a platform-specific insert string from the supplied data * * @param string $table Protected table name - * @param list $keys QBKeys - * @param list $unescapedKeys QBSet + * @param list $keys Keys of QBSet + * @param list $unescapedKeys Values of QBSet */ protected function _insert(string $table, array $keys, array $unescapedKeys): string { @@ -2419,8 +2419,8 @@ public function replace(?array $set = null) * Generates a platform-specific replace string from the supplied data * * @param string $table Protected table name - * @param list $keys QBKeys - * @param list $values QBSet + * @param list $keys Keys of QBSet + * @param list $values Values of QBSet */ protected function _replace(string $table, array $keys, array $values): string { @@ -2516,7 +2516,8 @@ public function update($set = null, $where = null, ?int $limit = null): bool /** * Generates a platform-specific update string from the supplied data * - * @param string $table Protected table name + * @param string $table Protected table name + * @param array $values QBSet */ protected function _update(string $table, array $values): string { From 715dff050873b7bf1183ef24e2af0678bf22659d Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Mon, 22 Apr 2024 09:45:41 +0700 Subject: [PATCH 4/5] docs: _like phpdocs --- phpstan-baseline.php | 5 ----- system/Database/BaseBuilder.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 3260e4b6f8cb..3fdb6424df80 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1791,11 +1791,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_like\\(\\) has parameter \\$field with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_whereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', 'count' => 1, diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index d552580703ec..36a6ba7d73b9 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -1090,7 +1090,7 @@ public function orNotHavingLike($field, string $match = '', string $side = 'both * @used-by notHavingLike() * @used-by orNotHavingLike() * - * @param array|RawSql|string $field + * @param list|RawSql|string $field * * @return $this */ From c6e17476f319df179d0b18c967e7732f039abb22 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Tue, 23 Apr 2024 11:24:25 +0700 Subject: [PATCH 5/5] Update system/Database/BaseBuilder.php Co-authored-by: kenjis --- system/Database/BaseBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 36a6ba7d73b9..c20f59920ff2 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -1090,7 +1090,7 @@ public function orNotHavingLike($field, string $match = '', string $side = 'both * @used-by notHavingLike() * @used-by orNotHavingLike() * - * @param list|RawSql|string $field + * @param array|RawSql|string $field * * @return $this */