fix: solve some warnings

Notifications.php: make $count parameter explicit as it is placed before
another explicit parameter
OpenVKPresenter.php: add additional null checks
Themepacks.php: add return type to offsetGet
This commit is contained in:
Alexander Minkin 2023-12-11 13:15:01 +03:00
parent 2eb15cb600
commit e813549602
Signed by untrusted user: WerySkok
GPG key ID: 88E9A2F3AFE44C30
3 changed files with 4 additions and 4 deletions

View file

@ -30,7 +30,7 @@ class Notifications
return (new $repoClassName)->get($id);
}
private function getQuery(User $user, bool $count = false, int $offset, bool $archived = false, int $page = 1, ?int $perPage = NULL): string
private function getQuery(User $user, bool $count, int $offset, bool $archived = false, int $page = 1, ?int $perPage = NULL): string
{
$query = "SELECT " . ($count ? "COUNT(*) AS cnt" : "*") . " FROM notifications WHERE recipientType=0 ";
$query .= "AND timestamp " . ($archived ? "<" : ">") . "$offset AND recipientId=" . $user->getId();

View file

@ -274,7 +274,7 @@ abstract class OpenVKPresenter extends SimplePresenter
setlocale(LC_TIME, ...(explode(";", tr("__locale"))));
if (!OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"]["all"]) {
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"][$this->presenterName]) {
if ($this->presenterName && OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"][$this->presenterName]) {
$this->pass("openvk!Maintenance->section", $this->presenterName);
}
} else {
@ -307,7 +307,7 @@ abstract class OpenVKPresenter extends SimplePresenter
$theme = Themepacks::i()[Session::i()->get("_sessionTheme", "ovk")];
} else if($this->requestParam("themePreview")) {
$theme = Themepacks::i()[$this->requestParam("themePreview")];
} else if($this->user->identity !== NULL && $this->user->identity->getTheme()) {
} else if($this->user !== NULL && $this->user->identity !== NULL && $this->user->identity->getTheme()) {
$theme = $this->user->identity->getTheme();
}

View file

@ -62,7 +62,7 @@ class Themepacks implements \ArrayAccess
return $offset === Themepacks::DEFAULT_THEME_ID ? false : isset($this->loadedThemepacks[$offset]);
}
function offsetGet($offset)
function offsetGet($offset) : mixed
{
return $this->loadedThemepacks[$offset];
}