Skip to content

Commit

Permalink
🚿 phan happy
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Aug 24, 2024
1 parent 30a4e0a commit a431b33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Drivers/MSSqlSrv.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/Drivers/MySQLiDrv.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/Drivers/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a431b33

Please sign in to comment.