PHPstan check for level 5
Fix various issues for phpstan level 5 Start initial settings for level 6 (needs type declarations for all vars)
This commit is contained in:
@@ -910,7 +910,7 @@ class IO extends \CoreLibs\Basic
|
||||
$this->db_debug = 0;
|
||||
} elseif ($this->db_debug) {
|
||||
$this->db_debug = 0;
|
||||
} elseif (!$this->db_debug) {
|
||||
} else {
|
||||
$this->db_debug = 1;
|
||||
}
|
||||
return $this->db_debug;
|
||||
@@ -1789,7 +1789,7 @@ class IO extends \CoreLibs\Basic
|
||||
);
|
||||
$this->insert_id_ext = $this->insert_id;
|
||||
$this->insert_id_arr[] = $this->insert_id;
|
||||
} elseif ($result) {
|
||||
} elseif (!empty($result)) {
|
||||
$this->insert_id = [];
|
||||
$this->insert_id_ext = [];
|
||||
$this->insert_id_arr = [];
|
||||
@@ -1988,8 +1988,6 @@ class IO extends \CoreLibs\Basic
|
||||
return 'f';
|
||||
}
|
||||
}
|
||||
// if neither, just return data as is
|
||||
return $string;
|
||||
}
|
||||
|
||||
// ** REMARK **
|
||||
@@ -2018,9 +2016,6 @@ class IO extends \CoreLibs\Basic
|
||||
if (!is_array($not_write_array)) {
|
||||
$not_write_array = [];
|
||||
}
|
||||
if (is_array($table)) {
|
||||
return false;
|
||||
}
|
||||
$not_write_update_array = [];
|
||||
return $this->dbWriteDataExt(
|
||||
$write_array,
|
||||
@@ -2077,8 +2072,8 @@ class IO extends \CoreLibs\Basic
|
||||
// loop through the write array and each field to build the query
|
||||
foreach ($write_array as $field) {
|
||||
if (
|
||||
(!$primary_key['value'] ||
|
||||
($primary_key['value'] &&
|
||||
(empty($primary_key['value']) ||
|
||||
(!empty($primary_key['value']) &&
|
||||
!in_array($field, $not_write_update_array))
|
||||
) &&
|
||||
!in_array($field, $not_write_array)
|
||||
|
||||
@@ -239,9 +239,9 @@ class PgSQL
|
||||
* if there is no pk_name tries to auto built it from the table name
|
||||
* this only works if db schema is after "no plural names. and pk name is table name + _id
|
||||
* detects schema prefix in table name
|
||||
* @param string $query query string
|
||||
* @param string $pk_name primary key name, if '' then auto detect
|
||||
* @return string|int primary key value
|
||||
* @param string $query query string
|
||||
* @param string $pk_name primary key name, if '' then auto detect
|
||||
* @return string|int|false primary key value
|
||||
*/
|
||||
public function __dbInsertId(string $query, string $pk_name)
|
||||
{
|
||||
@@ -274,6 +274,9 @@ class PgSQL
|
||||
$id = [-1, $q];
|
||||
}
|
||||
return $id;
|
||||
} else {
|
||||
//if not insert, return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,9 +354,7 @@ class PgSQL
|
||||
$this->dbh = pg_connect("host=" . $db_host . " port=" . $db_port . " user="
|
||||
. $db_user . " password=" . $db_pass . " dbname=" . $db_name . " sslmode=" . $db_ssl);
|
||||
if (!$this->dbh) {
|
||||
die("<!-- Can't connect [host=" . $db_host . " port=" . $db_port . " user="
|
||||
. $db_user . " password=XXXX dbname=" . $db_name . " sslmode=" . $db_ssl . "] //-->");
|
||||
return null;
|
||||
die("<!-- Can't connect to database //-->");
|
||||
}
|
||||
return $this->dbh;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user