1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 14:46:36 +02:00

PHPStan: Use @return void

PHPStan then warns abouts using the return value
This commit is contained in:
Jakub Vrana
2025-03-26 13:09:49 +01:00
parent 63c258a7f9
commit 3de9b23156
6 changed files with 47 additions and 47 deletions

View File

@@ -81,7 +81,7 @@ class Adminer {
}
/** Headers to send before HTML output
* @return null
* @return void
*/
function headers() {
}
@@ -119,7 +119,7 @@ class Adminer {
}
/** Print login form
* @return null
* @return void
*/
function loginForm() {
global $drivers;
@@ -180,7 +180,7 @@ class Adminer {
/** Print links after select heading
* @param TableStatus result of table_status1()
* @param string new item options, NULL for no new item
* @return null
* @return void
*/
function selectLinks($tableStatus, $set = "") {
global $driver;
@@ -230,7 +230,7 @@ class Adminer {
/** Print backward keys for row
* @param BackwardKey[] result of $this->backwardKeys()
* @param string[]
* @return null
* @return void
*/
function backwardKeysPrint($backwardKeys, $row) {
}
@@ -325,7 +325,7 @@ class Adminer {
/** Print table structure in tabular format
* @param Field[] data about individual fields
* @param TableStatus
* @return null
* @return void
*/
function tableStructurePrint($fields, $tableStatus = null) {
global $driver;
@@ -356,7 +356,7 @@ class Adminer {
/** Print list of indexes on table in tabular format
* @param Index[] data about all indexes on a table
* @return null
* @return void
*/
function tableIndexesPrint($indexes) {
echo "<table>\n";
@@ -377,7 +377,7 @@ class Adminer {
/** Print columns box in select
* @param list<string> result of selectColumnsProcess()[0]
* @param string[] selectable columns
* @return null
* @return void
*/
function selectColumnsPrint($select, $columns) {
global $driver;
@@ -405,7 +405,7 @@ class Adminer {
* @param list<string> result of selectSearchProcess()
* @param string[] selectable columns
* @param Index[]
* @return null
* @return void
*/
function selectSearchPrint($where, $columns, $indexes) {
print_fieldset("search", lang('Search'), $where);
@@ -441,7 +441,7 @@ class Adminer {
* @param list<string> result of selectOrderProcess()
* @param string[] selectable columns
* @param Index[]
* @return null
* @return void
*/
function selectOrderPrint($order, $columns, $indexes) {
print_fieldset("sort", lang('Sort'), $order);
@@ -460,7 +460,7 @@ class Adminer {
/** Print limit box in select
* @param string result of selectLimitProcess()
* @return null
* @return void
*/
function selectLimitPrint($limit) {
echo "<fieldset><legend>" . lang('Limit') . "</legend><div>"; // <div> for easy styling
@@ -471,7 +471,7 @@ class Adminer {
/** Print text length box in select
* @param string result of selectLengthProcess()
* @return null
* @return void
*/
function selectLengthPrint($text_length) {
if ($text_length !== null) {
@@ -483,7 +483,7 @@ class Adminer {
/** Print action box in select
* @param Index[]
* @return null
* @return void
*/
function selectActionPrint($indexes) {
echo "<fieldset><legend>" . lang('Action') . "</legend><div>";
@@ -525,7 +525,7 @@ class Adminer {
/** Print extra text in the end of a select form
* @param string[] fields holding e-mails
* @param string[] selectable columns
* @return null
* @return void
*/
function selectEmailPrint($emailFields, $columns) {
}
@@ -693,7 +693,7 @@ class Adminer {
* @param array[]
* @param mixed
* @param bool
* @return null
* @return void
*/
function editRowPrint($table, $fields, $row, $update) {
}
@@ -799,7 +799,7 @@ class Adminer {
/** Export database structure
* @param string
* @return null prints data
* @return void prints data
*/
function dumpDatabase($db) {
}
@@ -808,7 +808,7 @@ class Adminer {
* @param string
* @param string
* @param int 0 table, 1 view, 2 temporary view table
* @return null prints data
* @return void prints data
*/
function dumpTable($table, $style, $is_view = 0) {
if ($_POST["format"] != "sql") {
@@ -843,7 +843,7 @@ class Adminer {
* @param string
* @param string
* @param string
* @return null prints data
* @return void prints data
*/
function dumpData($table, $style, $query) {
global $connection;
@@ -964,7 +964,7 @@ class Adminer {
}
/** Print text after export
* @return null prints data
* @return void prints data
*/
function dumpFooter() {
if ($_POST["format"] == "sql") {
@@ -992,7 +992,7 @@ class Adminer {
/** Print navigation after Adminer title
* @param string can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema
* @return null
* @return void
*/
function navigation($missing) {
global $VERSION, $drivers, $connection;
@@ -1083,7 +1083,7 @@ class Adminer {
/** Print databases list in menu
* @param string
* @return null
* @return void
*/
function databasesPrint($missing) {
global $adminer, $connection;
@@ -1118,7 +1118,7 @@ class Adminer {
/** Print table list in menu
* @param TableStatus[] result of table_status('', true)
* @return null
* @return void
*/
function tablesPrint($tables) {
echo "<ul id='tables'>" . script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");

View File

@@ -6,7 +6,7 @@ namespace Adminer;
* @param string
* @param mixed ["key" => "link", "key2" => ["link", "desc"]], null for nothing, false for driver only, true for driver and server
* @param string used after colon in title and heading, should be HTML escaped
* @return null
* @return void
*/
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
global $LANG, $VERSION, $adminer, $drivers;
@@ -128,7 +128,7 @@ const thousandsSeparator = '" . js_escape(lang(',')) . "';")
}
/** Send HTTP headers
* @return null
* @return void
*/
function page_headers() {
global $adminer;
@@ -177,7 +177,7 @@ function get_nonce() {
/** Print flash and error messages
* @param string
* @return null
* @return void
*/
function page_messages($error) {
global $adminer;
@@ -197,7 +197,7 @@ function page_messages($error) {
/** Print HTML footer
* @param string "auth", "db", "ns"
* @return null
* @return void
*/
function page_footer($missing = "") {
global $adminer;

View File

@@ -6,7 +6,7 @@ $drivers = array();
/** Add a driver
* @param string
* @param string
* @return null
* @return void
*/
function add_driver($id, $name) {
global $drivers;

View File

@@ -127,7 +127,7 @@ function referencable_primary($self) {
* @param string or array in which case [0] of every element is used
* @param int
* @param int
* @return null
* @return void
*/
function textarea($name, $value, $rows = 10, $cols = 80) {
echo "<textarea name='" . h($name) . "' rows='$rows' cols='$cols' class='sqlarea jush-" . JUSH . "' spellcheck='false' wrap='off'>";
@@ -160,7 +160,7 @@ function select_input($attrs, $options, $value = "", $onchange = "", $placeholde
/** Print one row in JSON object
* @param string or "" to close the object
* @param string
* @return null
* @return void
*/
function json_row($key, $val = null) {
static $first = true;
@@ -182,7 +182,7 @@ function json_row($key, $val = null) {
* @param list<string>
* @param Field[] returned by referencable_primary()
* @param list<string> extra types to prepend
* @return null
* @return void
*/
function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) {
global $driver;
@@ -321,7 +321,7 @@ function type_class($type) {
* @param list<string>[]
* @param string TABLE or PROCEDURE
* @param Field[] returned by referencable_primary()
* @return null
* @return void
*/
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
global $driver;
@@ -463,7 +463,7 @@ function grant($grant, $privileges, $columns, $on) {
* @param string
* @param string
* @param string
* @return null redirect in success
* @return void redirect on success
*/
function drop_create($drop, $create, $drop_created, $test, $drop_test, $location, $message_drop, $message_alter, $message_create, $old_name, $new_name) {
if ($_POST["drop"]) {
@@ -554,7 +554,7 @@ function format_foreign_key($foreign_key) {
/** Add a file to TAR
* @param string
* @param TmpFile
* @return null prints the output
* @return void prints the output
*/
function tar_file($filename, $tmp_file) {
$return = pack("a100a8a8a8a12a12", $filename, 644, 0, 0, decoct($tmp_file->size), decoct(time()));
@@ -627,7 +627,7 @@ function db_size($db) {
/** Print SET NAMES if utf8mb4 might be needed
* @param string
* @return null
* @return void
*/
function set_utf8mb4($create) {
global $connection;

View File

@@ -94,7 +94,7 @@ function number_type() {
/** Disable magic_quotes_gpc
* @param list<array> e.g. (&$_GET, &$_POST, &$_COOKIE)
* @param bool whether to leave values as is
* @return null modified in place
* @return void modified in place
*/
function remove_slashes($process, $filter = false) {
if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
@@ -175,7 +175,7 @@ function sid() {
* @param string
* @param string
* @param string
* @return null
* @return void
*/
function set_password($vendor, $server, $username, $password) {
$_SESSION["pwds"][$vendor][$server][$username] = ($_COOKIE["adminer_key"] && is_string($password)
@@ -377,7 +377,7 @@ function convert_fields($columns, $fields, $select = array()) {
* @param string
* @param string
* @param int number of seconds, 0 for session cookie, 2592000 - 30 days
* @return null
* @return void
*/
function cookie($name, $value, $lifetime = 2592000) {
global $HTTPS;
@@ -413,14 +413,14 @@ function get_setting($key, $cookie = "adminer_settings") {
/** Store settings to a cookie
* @param mixed[]
* @param string
* @return null
* @return void
*/
function save_settings($settings, $cookie = "adminer_settings") {
cookie($cookie, http_build_query($settings + get_settings($cookie)));
}
/** Restart stopped session
* @return null
* @return void
*/
function restart_session() {
if (!ini_bool("session.use_cookies") && (!function_exists('session_status') || session_status() == 1)) { // 1 - PHP_SESSION_NONE, session_status() available since PHP 5.4
@@ -430,7 +430,7 @@ function restart_session() {
/** Stop session if possible
* @param bool
* @return null
* @return void
*/
function stop_session($force = false) {
$use_cookies = ini_bool("session.use_cookies");
@@ -495,7 +495,7 @@ function is_ajax() {
/** Send Location header and exit
* @param string null to only set a message
* @param string
* @return null
* @return void
*/
function redirect($location, $message = null) {
if ($message !== null) {
@@ -783,7 +783,7 @@ function dump_headers($identifier, $multi_table = false) {
/** Print CSV row
* @param string[]
* @return null
* @return void
*/
function dump_csv($row) {
foreach ($row as $key => $val) {

View File

@@ -157,7 +157,7 @@ function confirm($message = "", $selector = "qsl('input')") {
* @param string
* @param string
* @param bool
* @return null
* @return void
*/
function print_fieldset($id, $legend, $visible = false) {
echo "<fieldset><legend>";
@@ -218,7 +218,7 @@ function hidden_fields($process, $ignore = array(), $prefix = '') {
}
/** Print hidden fields for GET forms
* @return null
* @return void
*/
function hidden_fields_get() {
echo (sid() ? input_hidden(session_name(), session_id()) : '');
@@ -232,7 +232,7 @@ function hidden_fields_get() {
* @param Field
* @param mixed string|array
* @param string
* @return null
* @return string
*/
function enum_input($type, $attrs, $field, $value, $empty = null) {
global $adminer;
@@ -251,7 +251,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) {
* @param mixed
* @param string
* @param bool
* @return null
* @return void
*/
function input($field, $value, $function, $autofocus = false) {
global $driver, $adminer;
@@ -395,7 +395,7 @@ function process_input($field) {
/** Print results of search in all tables
* @uses $_GET["where"][0]
* @uses $_POST["tables"]
* @return null
* @return void
*/
function search_tables() {
global $adminer, $connection;
@@ -429,7 +429,7 @@ function on_help($command, $side = 0) {
* @param Field[]
* @param mixed
* @param bool
* @return null
* @return void
*/
function edit_form($table, $fields, $row, $update) {
global $adminer, $error;