mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 19:44:00 +02:00
PHPStan: Fix level 3 errors
This commit is contained in:
@@ -53,7 +53,7 @@ abstract class SqlDriver {
|
||||
}
|
||||
|
||||
/** Get structured types
|
||||
* @return list<string>[] [$description => [$type, ...], ...]
|
||||
* @return list<string>[]|list<string> [$description => [$type, ...], ...]
|
||||
*/
|
||||
function structuredTypes() {
|
||||
return array_map('array_keys', $this->types);
|
||||
@@ -82,7 +82,7 @@ abstract class SqlDriver {
|
||||
* @param int result of $adminer->selectLimitProcess()
|
||||
* @param int index of page starting at zero
|
||||
* @param bool whether to print the query
|
||||
* @return Result
|
||||
* @return Result|false
|
||||
*/
|
||||
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||
global $adminer;
|
||||
@@ -109,7 +109,7 @@ abstract class SqlDriver {
|
||||
* @param string
|
||||
* @param string " WHERE ..."
|
||||
* @param int 0 or 1
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function delete($table, $queryWhere, $limit = 0) {
|
||||
$query = "FROM " . table($table);
|
||||
@@ -122,7 +122,7 @@ abstract class SqlDriver {
|
||||
* @param string " WHERE ..."
|
||||
* @param int 0 or 1
|
||||
* @param string
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function update($table, $set, $queryWhere, $limit = 0, $separator = "\n") {
|
||||
$values = array();
|
||||
@@ -136,7 +136,7 @@ abstract class SqlDriver {
|
||||
/** Insert data into table
|
||||
* @param string
|
||||
* @param string[] escaped columns in keys, quoted data in values
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function insert($table, $set) {
|
||||
return queries("INSERT INTO " . table($table) . ($set
|
||||
@@ -145,7 +145,7 @@ abstract class SqlDriver {
|
||||
) . $this->insertReturning($table));
|
||||
}
|
||||
|
||||
/** Get RETURNING clause for INSERT queries, PostgreSQL specific
|
||||
/** Get RETURNING clause for INSERT queries (PostgreSQL specific)
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
@@ -157,28 +157,28 @@ abstract class SqlDriver {
|
||||
* @param string
|
||||
* @param list<string[]> of arrays with escaped columns in keys and quoted data in values
|
||||
* @param int[] column names in keys
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function insertUpdate($table, $rows, $primary) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Begin transaction
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function begin() {
|
||||
return queries("BEGIN");
|
||||
}
|
||||
|
||||
/** Commit transaction
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function commit() {
|
||||
return queries("COMMIT");
|
||||
}
|
||||
|
||||
/** Rollback transaction
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function rollback() {
|
||||
return queries("ROLLBACK");
|
||||
|
@@ -435,7 +435,7 @@ function normalize_enum($match) {
|
||||
* @param list<string>
|
||||
* @param string
|
||||
* @param string
|
||||
* @return bool
|
||||
* @return Result|bool
|
||||
*/
|
||||
function grant($grant, $privileges, $columns, $on) {
|
||||
if (!$privileges) {
|
||||
@@ -502,7 +502,7 @@ function create_trigger($on, $row) {
|
||||
|
||||
/** Generate SQL query for creating routine
|
||||
* @param string "PROCEDURE" or "FUNCTION"
|
||||
* @param string[] result of routine()
|
||||
* @param Routine result of routine()
|
||||
* @return string
|
||||
*/
|
||||
function create_routine($routine, $row) {
|
||||
|
@@ -722,7 +722,7 @@ function table_status1($table, $fast = false) {
|
||||
|
||||
/** Find out foreign keys for each column
|
||||
* @param string
|
||||
* @return list<string>[] [$col => []]
|
||||
* @return list<ForeignKey>[] [$col => []]
|
||||
*/
|
||||
function column_foreign_keys($table) {
|
||||
global $adminer;
|
||||
@@ -814,7 +814,7 @@ function get_temp_dir() {
|
||||
} else {
|
||||
$filename = @tempnam("", ""); // @ - temp directory can be disabled by open_basedir
|
||||
if (!$filename) {
|
||||
return false;
|
||||
return '';
|
||||
}
|
||||
$return = dirname($filename);
|
||||
unlink($filename);
|
||||
@@ -825,7 +825,7 @@ function get_temp_dir() {
|
||||
|
||||
/** Open and exclusively lock a file
|
||||
* @param string
|
||||
* @return resource or null for error
|
||||
* @return resource|void null for error
|
||||
*/
|
||||
function file_open_lock($filename) {
|
||||
if (is_link($filename)) {
|
||||
@@ -873,7 +873,7 @@ function first($array) {
|
||||
|
||||
/** Read password from file adminer.key in temporary directory or create one
|
||||
* @param bool
|
||||
* @return string or false if the file can not be created
|
||||
* @return string|false false if the file can not be created
|
||||
*/
|
||||
function password_file($create) {
|
||||
$filename = get_temp_dir() . "/adminer.key";
|
||||
|
@@ -344,12 +344,12 @@ function input($field, $value, $function, $autofocus = false) {
|
||||
|
||||
/** Process edit input field
|
||||
* @param Field one field from fields()
|
||||
* @return string or false to leave the original value
|
||||
* @return mixed false to leave the original value
|
||||
*/
|
||||
function process_input($field) {
|
||||
global $adminer, $driver;
|
||||
if (stripos($field["default"], "GENERATED ALWAYS AS ") === 0) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
$idf = bracket_escape($field["field"]);
|
||||
$function = idx($_POST["function"], $idf);
|
||||
|
@@ -75,7 +75,7 @@ function encrypt_string($str, $key) {
|
||||
/** Decipher
|
||||
* @param string binary cipher
|
||||
* @param string
|
||||
* @return string plain-text password
|
||||
* @return string|false plain-text password
|
||||
*/
|
||||
function decrypt_string($str, $key) {
|
||||
if ($str == "") {
|
||||
|
Reference in New Issue
Block a user