Skip to content

Commit af9e760

Browse files
committed
fix: added missing typings
1 parent b204387 commit af9e760

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

phpmyfaq/faq.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
$multiCategories = $category->getCategoriesFromFaq($faqId);
189189
if ((is_countable($multiCategories) ? count($multiCategories) : 0) > 1) {
190190
foreach ($multiCategories as $multiCategory) {
191-
$path = $category->getPath($multiCategory['id'], ' » ', true, 'list-unstyled');
191+
$path = $category->getPath((int) $multiCategory['id'], ' » ', true, 'list-unstyled');
192192
if ('' === trim($path)) {
193193
continue;
194194
}
@@ -213,7 +213,7 @@
213213

214214
// Number of comments
215215
$numComments = $comment->getNumberOfComments();
216-
$comments = $comment->getCommentsData($faqId, CommentType::FAQ);
216+
$comments = $comment->getCommentsData((int) $faqId, CommentType::FAQ);
217217

218218
$commentHelper = new CommentHelper();
219219
$commentHelper->setConfiguration($faqConfig);

phpmyfaq/src/phpMyFAQ/Comments.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function getCommentsData(int $referenceId, string $type): array
6464
while ($row = $this->configuration->getDb()->fetchObject($result)) {
6565
$comment = new Comment();
6666
$comment
67-
->setId($row->id_comment)
68-
->setRecordId($row->id)
67+
->setId((int) $row->id_comment)
68+
->setRecordId((int) $row->id)
6969
->setComment($row->comment)
7070
->setDate(Date::createIsoDate($row->datum, DateTimeInterface::ATOM, false))
7171
->setUsername($row->usr)

phpmyfaq/src/phpMyFAQ/Helper/FaqHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function renderChangeLanguageSelector(Faq $faq, int $categoryId): string
7272
$oLink = new Link($this->configuration->getDefaultUrl() . $faqUrl, $this->configuration);
7373
$oLink->itemTitle = $faq->faqRecord['title'];
7474

75-
$availableLanguages = $this->configuration->getLanguage()->isLanguageAvailable($faq->faqRecord['id']);
75+
$availableLanguages = $this->configuration->getLanguage()->isLanguageAvailable((int) $faq->faqRecord['id']);
7676

7777
if ((is_countable($availableLanguages) ? count($availableLanguages) : 0) > 1) {
7878
$html = '<form method="post">';

phpmyfaq/src/phpMyFAQ/Search/SearchResultSet.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,28 @@ public function reviewResultSet(array $resultSet): void
8080
$this->setResultSet($resultSet);
8181

8282
$duplicateResults = [];
83+
$currentGroupIds = [-1];
8384

8485
if ('basic' !== $this->configuration->get('security.permLevel')) {
85-
// @phpstan-ignore-next-line
8686
$currentGroupIds = $this->currentUser->perm->getUserGroups($this->currentUser->getUserId());
87-
} else {
88-
$currentGroupIds = [-1];
8987
}
9088

9189
foreach ($this->rawResultSet as $result) {
9290
$permission = false;
9391

9492
// check permissions for groups
9593
if ('medium' === $this->configuration->get('security.permLevel')) {
96-
$groupPermissions = $this->faqPermission->get(Permission::GROUP, $result->id);
94+
$groupPermissions = $this->faqPermission->get(Permission::GROUP, (int) $result->id);
9795
foreach ($groupPermissions as $groupPermission) {
9896
if (in_array($groupPermission, $currentGroupIds)) {
9997
$permission = true;
10098
}
10199
}
102100
}
103101

104-
// check permission for user
102+
// check permission for a user
105103
if ('basic' === $this->configuration->get('security.permLevel')) {
106-
$userPermission = $this->faqPermission->get(Permission::USER, $result->id);
104+
$userPermission = $this->faqPermission->get(Permission::USER, (int) $result->id);
107105
$permission =
108106
in_array(-1, $userPermission) || in_array($this->currentUser->getUserId(), $userPermission);
109107
}

0 commit comments

Comments
 (0)