Fixed static analysis detections.
This commit is contained in:
parent
c14195c4c3
commit
9682fa595a
7 changed files with 17 additions and 21 deletions
|
@ -57,7 +57,7 @@ class Emotes {
|
|||
|
||||
$query .= sprintf(' ORDER BY %s', self::EMOTE_ORDER[$orderBy]);
|
||||
if($hasReverse)
|
||||
$query .= $hasReverse ? ' DESC' : ' ASC';
|
||||
$query .= $reverse ? ' DESC' : ' ASC';
|
||||
}
|
||||
|
||||
$stmt = $this->cache->get($query);
|
||||
|
|
|
@ -55,10 +55,11 @@ class Forum {
|
|||
ForumCategoryInfo|string|null|false $parentInfo = false,
|
||||
string|int|null $type = null,
|
||||
?bool $hidden = null
|
||||
): array {
|
||||
): int {
|
||||
if($parentInfo instanceof ForumCategoryInfo)
|
||||
$parentInfo = $parentInfo->getId();
|
||||
|
||||
$isRootParent = false;
|
||||
$hasParentInfo = $parentInfo !== false;
|
||||
$hasType = $type !== null;
|
||||
$hasHidden = $hidden !== null;
|
||||
|
@ -89,7 +90,7 @@ class Forum {
|
|||
$args = 0;
|
||||
$stmt = $this->cache->get($query);
|
||||
if($hasParentInfo && !$isRootParent)
|
||||
$stmt->addParameter(++$args, $parentInfo->getId());
|
||||
$stmt->addParameter(++$args, $parentInfo);
|
||||
if($hasType)
|
||||
$stmt->addParameter(++$args, $type);
|
||||
$stmt->execute();
|
||||
|
@ -105,6 +106,7 @@ class Forum {
|
|||
bool $asTree = false,
|
||||
?Pagination $pagination = null
|
||||
): array {
|
||||
$isRootParent = false;
|
||||
$hasParentInfo = $parentInfo !== false;
|
||||
$hasType = $type !== null;
|
||||
$hasHidden = $hidden !== null;
|
||||
|
@ -581,6 +583,7 @@ class Forum {
|
|||
// remove this hack when search server
|
||||
$hasSearchQuery = $searchQuery !== null;
|
||||
$hasAfterTopicId = false;
|
||||
$afterTopicId = null;
|
||||
$doSearchOrder = false;
|
||||
if($hasSearchQuery) {
|
||||
if(!empty($searchQuery['type'])
|
||||
|
@ -1193,6 +1196,7 @@ class Forum {
|
|||
// remove this hack when search server
|
||||
$hasSearchQuery = $searchQuery !== null;
|
||||
$hasAfterPostId = false;
|
||||
$afterPostId = null;
|
||||
$doSearchOrder = false;
|
||||
if($hasSearchQuery) {
|
||||
if(!empty($searchQuery['type'])
|
||||
|
|
|
@ -8,7 +8,7 @@ class ForumTopicRedirectInfo {
|
|||
private string $topicId;
|
||||
private ?string $userId;
|
||||
private string $link;
|
||||
private string $created;
|
||||
private int $created;
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->topicId = (string)$result->getInteger(0);
|
||||
|
|
|
@ -20,15 +20,6 @@ class News {
|
|||
$this->cache = new DbStatementCache($dbConn);
|
||||
}
|
||||
|
||||
private function readPosts(IDbResult $result): array {
|
||||
$posts = [];
|
||||
|
||||
while($result->next())
|
||||
$posts[] = new NewsPostInfo($result);
|
||||
|
||||
return $posts;
|
||||
}
|
||||
|
||||
public function countCategories(
|
||||
?bool $hidden = null
|
||||
): int {
|
||||
|
|
|
@ -317,9 +317,10 @@ final class Perm {
|
|||
|
||||
$categoryName = $currentCategoryName;
|
||||
$perm = 0;
|
||||
if(is_array($permInfo))
|
||||
[$categoryName, $perm] = $permInfo;
|
||||
elseif(is_int($permInfo))
|
||||
// if(is_array($permInfo))
|
||||
// [$categoryName, $perm] = $permInfo;
|
||||
// else
|
||||
if(is_int($permInfo))
|
||||
$perm = $permInfo;
|
||||
|
||||
$item->perms[] = $permItem = new stdClass;
|
||||
|
|
|
@ -15,9 +15,9 @@ class PermissionInfo implements IPermissionResult {
|
|||
private int $calculated;
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->userId = $result->isNull(0) ? null : $result->getInteger(0);
|
||||
$this->roleId = $result->isNull(1) ? null : $result->getInteger(1);
|
||||
$this->forumCategoryId = $result->isNull(2) ? null : $result->getInteger(2);
|
||||
$this->userId = $result->isNull(0) ? null : $result->getString(0);
|
||||
$this->roleId = $result->isNull(1) ? null : $result->getString(1);
|
||||
$this->forumCategoryId = $result->isNull(2) ? null : $result->getString(2);
|
||||
$this->category = $result->getString(3);
|
||||
$this->allow = $result->getInteger(4);
|
||||
$this->deny = $result->getInteger(5);
|
||||
|
|
|
@ -53,7 +53,7 @@ class AssetsRoutes {
|
|||
} catch(RuntimeException $ex) {
|
||||
} catch(InvalidArgumentException $ex) {}
|
||||
|
||||
return $this->serveAsset($response, $request, $assetInfo);
|
||||
$this->serveAsset($response, $request, $assetInfo);
|
||||
}
|
||||
|
||||
public function getProfileBackground($response, $request, string $fileName = '') {
|
||||
|
@ -76,7 +76,7 @@ class AssetsRoutes {
|
|||
return 404;
|
||||
}
|
||||
|
||||
return $this->serveAsset($response, $request, $assetInfo);
|
||||
$this->serveAsset($response, $request, $assetInfo);
|
||||
}
|
||||
|
||||
public function getUserAssets($response, $request) {
|
||||
|
|
Loading…
Reference in a new issue