1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-17 03:53:59 +02:00

PHPStan: Fix level 4 errors

This commit is contained in:
Jakub Vrana
2025-03-26 18:32:45 +01:00
parent 53d5e7b60a
commit c78299a3f6
7 changed files with 73 additions and 51 deletions

View File

@@ -444,7 +444,7 @@ if (!defined('Adminer\DRIVER')) {
/** Connect to the database
* @param array{string, string, string} [$server, $username, $password]
* @return mixed Db or string for error
* @return string|Db string for error
*/
function connect($credentials) {
global $drivers;
@@ -1073,47 +1073,12 @@ if (!defined('Adminer\DRIVER')) {
/** Get approximate number of rows
* @param TableStatus
* @param list<string>
* @return numeric-string|void null if approximate number can't be retrieved
* @return numeric-string|null null if approximate number can't be retrieved
*/
function found_rows($table_status, $where) {
return ($where || $table_status["Engine"] != "InnoDB" ? null : $table_status["Rows"]);
}
/* Not used is MySQL but checked in compile.php:
/** Get user defined types
* @return string[] [$id => $name]
function types() {
return array();
}
/** Get values of user defined type
* @param int
* @return string
function type_values($id) {
return "";
}
/** Get existing schemas
* @return list<string>
function schemas() {
return array();
}
/** Get current schema
* @return string
function get_schema() {
return "";
}
/** Set current schema
* @param string
* @param Db
* @return bool
function set_schema($schema, $connection2 = null) {
return true;
}
*/
/** Get SQL command to create table
* @param string
* @param bool
@@ -1241,4 +1206,44 @@ if (!defined('Adminer\DRIVER')) {
function max_connections() {
return get_val("SELECT @@max_connections");
}
// Not used is MySQL but checked in compile.php:
/** Get user defined types
* @return string[] [$id => $name]
*/
function types() {
return array();
}
/** Get values of user defined type
* @param int
* @return string
*/
function type_values($id) {
return "";
}
/** Get existing schemas
* @return list<string>
*/
function schemas() {
return array();
}
/** Get current schema
* @return string
*/
function get_schema() {
return "";
}
/** Set current schema
* @param string
* @param Db
* @return bool
*/
function set_schema($schema, $connection2 = null) {
return true;
}
}

View File

@@ -854,7 +854,7 @@ AND typelem = 0"
}
$fields = fields($table);
if (!$status || empty($fields)) {
if (count($status) < 2 || empty($fields)) {
return false;
}