1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 15:16: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

@@ -76,19 +76,19 @@ abstract class SqlDriver {
* @param list<string> $where result of adminer()->selectSearchProcess()
* @param list<string> $group result of adminer()->selectColumnsProcess()[1]
* @param list<string> $order result of adminer()->selectOrderProcess()
* @param int|numeric-string $limit result of adminer()->selectLimitProcess()
* @param int $limit result of adminer()->selectLimitProcess()
* @param int $page index of page starting at zero
* @param bool $print whether to print the query
* @return Result|false
*/
function select(string $table, array $select, array $where, array $group, array $order = array(), $limit = 1, ?int $page = 0, bool $print = false) {
function select(string $table, array $select, array $where, array $group, array $order = array(), int $limit = 1, ?int $page = 0, bool $print = false) {
$is_group = (count($group) < count($select));
$query = adminer()->selectQueryBuild($select, $where, $group, $order, $limit, $page);
if (!$query) {
$query = "SELECT" . limit(
($_GET["page"] != "last" && $limit != "" && $group && $is_group && JUSH == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) . "\nFROM " . table($table),
($_GET["page"] != "last" && $limit && $group && $is_group && JUSH == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) . "\nFROM " . table($table),
($where ? "\nWHERE " . implode(" AND ", $where) : "") . ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : ""),
($limit != "" ? +$limit : null),
$limit,
($page ? $limit * $page : 0),
"\n"
);