mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Explicitly mark nullable params (thanks to @dg)
This commit is contained in:
@@ -97,7 +97,7 @@ class Adminer {
|
|||||||
* @param bool $dark dark CSS: false to disable, true to force, null to base on user preferences
|
* @param bool $dark dark CSS: false to disable, true to force, null to base on user preferences
|
||||||
* @return bool true to link favicon.ico
|
* @return bool true to link favicon.ico
|
||||||
*/
|
*/
|
||||||
function head(bool $dark = null): bool {
|
function head(?bool $dark = null): bool {
|
||||||
// this is matched by compile.php
|
// this is matched by compile.php
|
||||||
echo "<link rel='stylesheet' href='../externals/jush/jush.css'>\n";
|
echo "<link rel='stylesheet' href='../externals/jush/jush.css'>\n";
|
||||||
echo ($dark !== false ? "<link rel='stylesheet'" . ($dark ? "" : " media='(prefers-color-scheme: dark)'") . " href='../externals/jush/jush-dark.css'>\n" : "");
|
echo ($dark !== false ? "<link rel='stylesheet'" . ($dark ? "" : " media='(prefers-color-scheme: dark)'") . " href='../externals/jush/jush-dark.css'>\n" : "");
|
||||||
@@ -304,7 +304,7 @@ class Adminer {
|
|||||||
* @param Field[] $fields
|
* @param Field[] $fields
|
||||||
* @param TableStatus $tableStatus
|
* @param TableStatus $tableStatus
|
||||||
*/
|
*/
|
||||||
function tableStructurePrint(array $fields, array $tableStatus = null): void {
|
function tableStructurePrint(array $fields, ?array $tableStatus = null): void {
|
||||||
echo "<div class='scrollable'>\n";
|
echo "<div class='scrollable'>\n";
|
||||||
echo "<table class='nowrap odds'>\n";
|
echo "<table class='nowrap odds'>\n";
|
||||||
echo "<thead><tr><th>" . lang('Column') . "<td>" . lang('Type') . (support("comment") ? "<td>" . lang('Comment') : "") . "</thead>\n";
|
echo "<thead><tr><th>" . lang('Column') . "<td>" . lang('Type') . (support("comment") ? "<td>" . lang('Comment') : "") . "</thead>\n";
|
||||||
|
@@ -386,7 +386,7 @@ function set_session(string $key, $val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get authenticated URL */
|
/** Get authenticated URL */
|
||||||
function auth_url(string $vendor, ?string $server, string $username, string $db = null): string {
|
function auth_url(string $vendor, ?string $server, string $username, ?string $db = null): string {
|
||||||
$uri = remove_from_uri(implode("|", array_keys(SqlDriver::$drivers))
|
$uri = remove_from_uri(implode("|", array_keys(SqlDriver::$drivers))
|
||||||
. "|username|ext|"
|
. "|username|ext|"
|
||||||
. ($db !== null ? "db|" : "")
|
. ($db !== null ? "db|" : "")
|
||||||
@@ -412,7 +412,7 @@ function is_ajax(): bool {
|
|||||||
/** Send Location header and exit
|
/** Send Location header and exit
|
||||||
* @param ?string $location null to only set a message
|
* @param ?string $location null to only set a message
|
||||||
*/
|
*/
|
||||||
function redirect(?string $location, string $message = null): void {
|
function redirect(?string $location, ?string $message = null): void {
|
||||||
if ($message !== null) {
|
if ($message !== null) {
|
||||||
restart_session();
|
restart_session();
|
||||||
$_SESSION["messages"][preg_replace('~^[^?]*~', '', ($location !== null ? $location : $_SERVER["REQUEST_URI"]))][] = $message;
|
$_SESSION["messages"][preg_replace('~^[^?]*~', '', ($location !== null ? $location : $_SERVER["REQUEST_URI"]))][] = $message;
|
||||||
|
@@ -173,7 +173,7 @@ function hidden_fields_get(): void {
|
|||||||
* @param Field $field
|
* @param Field $field
|
||||||
* @param mixed $value string|array
|
* @param mixed $value string|array
|
||||||
*/
|
*/
|
||||||
function enum_input(string $type, string $attrs, array $field, $value, string $empty = null): string {
|
function enum_input(string $type, string $attrs, array $field, $value, ?string $empty = null): string {
|
||||||
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
||||||
$return = ($empty !== null ? "<label><input type='$type'$attrs value='$empty'" . ((is_array($value) ? in_array($empty, $value) : $value === $empty) ? " checked" : "") . "><i>" . lang('empty') . "</i></label>" : "");
|
$return = ($empty !== null ? "<label><input type='$type'$attrs value='$empty'" . ((is_array($value) ? in_array($empty, $value) : $value === $empty) ? " checked" : "") . "><i>" . lang('empty') . "</i></label>" : "");
|
||||||
foreach ($matches[1] as $i => $val) {
|
foreach ($matches[1] as $i => $val) {
|
||||||
|
@@ -15,7 +15,7 @@ class AdminerEditCalendar {
|
|||||||
* @param string $prepend text to append before first calendar usage
|
* @param string $prepend text to append before first calendar usage
|
||||||
* @param string $langPath path to language file, %s stands for language code
|
* @param string $langPath path to language file, %s stands for language code
|
||||||
*/
|
*/
|
||||||
function __construct(string $prepend = null, string $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") {
|
function __construct($prepend = null, $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") {
|
||||||
$this->prepend = $prepend;
|
$this->prepend = $prepend;
|
||||||
$this->langPath = $langPath;
|
$this->langPath = $langPath;
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ class AdminerFileUpload {
|
|||||||
* @param string $displayPath prefix for displaying data, null stands for $uploadPath
|
* @param string $displayPath prefix for displaying data, null stands for $uploadPath
|
||||||
* @param string $extensions regular expression with allowed file extensions
|
* @param string $extensions regular expression with allowed file extensions
|
||||||
*/
|
*/
|
||||||
function __construct(string $uploadPath = "../static/data/", string $displayPath = null, string $extensions = "[a-zA-Z0-9]+") {
|
function __construct($uploadPath = "../static/data/", $displayPath = null, $extensions = "[a-zA-Z0-9]+") {
|
||||||
$this->uploadPath = $uploadPath;
|
$this->uploadPath = $uploadPath;
|
||||||
$this->displayPath = ($displayPath !== null ? $displayPath : $uploadPath);
|
$this->displayPath = ($displayPath !== null ? $displayPath : $uploadPath);
|
||||||
$this->extensions = $extensions;
|
$this->extensions = $extensions;
|
||||||
|
Reference in New Issue
Block a user