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

PHPStan: Use int for $limit

This commit is contained in:
Jakub Vrana
2025-03-30 21:08:19 +02:00
parent 016c1b2357
commit b50d19629f
14 changed files with 25 additions and 28 deletions

View File

@@ -243,7 +243,7 @@ if (isset($_GET["clickhouse"])) {
}
function limit($query, $where, $limit, $offset = 0, $separator = " ") {
return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? ", $offset" : "") : "");
return " $query$where" . ($limit ? $separator . "LIMIT $limit" . ($offset ? ", $offset" : "") : "");
}
function limit1($table, $query, $where, $separator = "\n") {

View File

@@ -146,7 +146,7 @@ if (isset($_GET["elastic"])) {
}
if ($limit) {
$data["size"] = +$limit;
$data["size"] = $limit;
if ($page) {
$data["from"] = ($page * $limit);
}
@@ -308,7 +308,7 @@ if (isset($_GET["elastic"])) {
}
function limit($query, $where, $limit, $offset = 0, $separator = " ") {
return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
return " $query$where" . ($limit ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
}
function collations() {

View File

@@ -107,7 +107,7 @@ if (isset($_GET["firebird"])) {
function limit($query, $where, $limit, $offset = 0, $separator = " ") {
$return = '';
$return .= ($limit !== null ? $separator . "FIRST $limit" . ($offset ? " SKIP $offset" : "") : "");
$return .= ($limit ? $separator . "FIRST $limit" . ($offset ? " SKIP $offset" : "") : "");
$return .= " $query$where";
return $return;
}

View File

@@ -208,7 +208,7 @@ if (isset($_GET["imap"])) {
}
function limit($query, $where, $limit, $offset = 0, $separator = " ") {
return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
return " $query$where" . ($limit ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
}
function idf_escape($idf) {

View File

@@ -344,10 +344,7 @@ if (isset($_GET["mongo"])) {
$val = preg_replace('~ DESC$~', '', $val, 1, $count);
$sort[$val] = ($count ? -1 : 1);
}
if (isset($_GET['limit']) && is_numeric($_GET['limit']) && $_GET['limit'] > 0) {
$limit = $_GET['limit'];
}
$limit = min(200, max(1, (int) $limit));
$limit = min(200, max(1, $limit));
$skip = $page * $limit;
try {
return new Result($this->conn->_link->executeQuery($this->conn->_db_name . ".$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));

View File

@@ -340,7 +340,7 @@ if (isset($_GET["simpledb"])) {
}
function limit($query, $where, $limit, $offset = 0, $separator = " ") {
return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" : "");
return " $query$where" . ($limit ? $separator . "LIMIT $limit" : "");
}
function unconvert_field($field, $return) {