From a431b335ad6f52bab12eee9f774c9be880a9dc1a Mon Sep 17 00:00:00 2001 From: smiley Date: Sun, 25 Aug 2024 01:58:21 +0200 Subject: [PATCH] :shower: phan happy --- src/Drivers/MSSqlSrv.php | 3 ++- src/Drivers/MySQLiDrv.php | 4 ++++ src/Drivers/PostgreSQL.php | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Drivers/MSSqlSrv.php b/src/Drivers/MSSqlSrv.php index f69a9d5..b83bb60 100644 --- a/src/Drivers/MSSqlSrv.php +++ b/src/Drivers/MSSqlSrv.php @@ -19,6 +19,7 @@ use function array_values, bin2hex, gettype, implode, is_bool, is_numeric, sprintf, sqlsrv_client_info, sqlsrv_close, sqlsrv_connect, sqlsrv_errors, sqlsrv_free_stmt, sqlsrv_query, sqlsrv_server_info; +use function sqlsrv_fetch_array; use const PHP_OS, SQLSRV_FETCH_ASSOC, SQLSRV_FETCH_NUMERIC; /** @@ -231,7 +232,7 @@ private function get_result($result, string|null $index = null, bool|null $assoc } $r = parent::getResult( - 'sqlsrv_fetch_array', + sqlsrv_fetch_array(...), /** @phan-suppress-next-line PhanUndeclaredConstant */ [$result, ($assoc ?? true) ? SQLSRV_FETCH_ASSOC : SQLSRV_FETCH_NUMERIC], $index, diff --git a/src/Drivers/MySQLiDrv.php b/src/Drivers/MySQLiDrv.php index 1af0af4..07404e1 100644 --- a/src/Drivers/MySQLiDrv.php +++ b/src/Drivers/MySQLiDrv.php @@ -167,6 +167,7 @@ protected function prepared_query(string $sql, array|null $values = null, string $this->stmtError($this->db->errno, $this->db->error); if(count($values) > 0){ + /** @phan-suppress-next-line PhanParamTooFewInternalUnpack, PhanTypeNonVarPassByRef */ $stmt->bind_param(...$this->getReferences($values)); } @@ -190,6 +191,7 @@ protected function prepared_query(string $sql, array|null $values = null, string $refs[] = &$cols[$assoc ? $field->name : $k]; } + /** @phan-suppress-next-line PhanParamTooFewInternalUnpack */ $stmt->bind_result(...$refs); // fetch the data @@ -229,6 +231,7 @@ protected function multi_query(string $sql, array $values):bool{ $this->stmtError($this->db->errno, $this->db->error); foreach($values as $row){ + /** @phan-suppress-next-line PhanParamTooFewInternalUnpack, PhanTypeNonVarPassByRef */ $stmt->bind_param(...$this->getReferences($row)); $stmt->execute(); @@ -251,6 +254,7 @@ protected function multi_callback_query(string $sql, array $data, Closure $callb $row = $callback($row, $k); if(is_array($row) && !empty($row)){ + /** @phan-suppress-next-line PhanParamTooFewInternalUnpack, PhanTypeNonVarPassByRef */ $stmt->bind_param(...$this->getReferences($row)); $stmt->execute(); diff --git a/src/Drivers/PostgreSQL.php b/src/Drivers/PostgreSQL.php index 7b73675..d57495b 100644 --- a/src/Drivers/PostgreSQL.php +++ b/src/Drivers/PostgreSQL.php @@ -246,6 +246,7 @@ private function get_result(PgSqlResult|false $result, string|null $index = null private function replaceParams(string $sql):string{ $i = 1; + /** @phan-suppress-next-line PhanTypeMismatchArgumentInternal */ return preg_replace_callback('/(\?)/', function() use (&$i){ return '$'.$i++; }, $sql);