1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-09 05:02:44 +03:00

improve typehints on db_insert (requires php7)

This commit is contained in:
David Goodwin
2021-04-05 21:10:56 +01:00
parent c300a8070e
commit 962e80c40c

View File

@@ -1901,7 +1901,7 @@ function db_delete($table, $where, $delete, $additionalwhere='') {
* @param boolean $throw_exceptions
* @return int - number of inserted rows
*/
function db_insert($table, array $values, $timestamp = array('created', 'modified'), $throw_exceptions = false) {
function db_insert(string $table, array $values, array $timestamp = array('created', 'modified'), bool $throw_exceptions = false) : int {
$table = table_by_key($table);
foreach ($timestamp as $key) {
@@ -1926,7 +1926,6 @@ function db_insert($table, array $values, $timestamp = array('created', 'modifie
$comma = ',';
}
return db_execute(
"INSERT INTO $table (" . implode(",", array_keys($values)) .") VALUES ($value_string)",
$prepared_statment_values,