summaryrefslogtreecommitdiffstats
path: root/apps/comments/lib/Collaboration
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-03-15 17:17:36 +0100
committerCarl Schwan <carl@carlschwan.eu>2022-03-16 13:14:15 +0100
commitfa266165d6d38f963dd44e227ee076799697f482 (patch)
tree482f7ad48d68e4fc233cb9857eee41ad35df8f8d /apps/comments/lib/Collaboration
parent3e067edcbe80797a70118f613ac4b752ce512992 (diff)
downloadnextcloud-server-fa266165d6d38f963dd44e227ee076799697f482.tar.gz
nextcloud-server-fa266165d6d38f963dd44e227ee076799697f482.zip
Modernize comments app
* Use php 7.4 typed properties * More typed methods (and replace existing php doc in some cases) * query -> get for Container Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/comments/lib/Collaboration')
-rw-r--r--apps/comments/lib/Collaboration/CommentersSorter.php16
1 files changed, 5 insertions, 11 deletions
diff --git a/apps/comments/lib/Collaboration/CommentersSorter.php b/apps/comments/lib/Collaboration/CommentersSorter.php
index 065e932fc9f..8723b132e03 100644
--- a/apps/comments/lib/Collaboration/CommentersSorter.php
+++ b/apps/comments/lib/Collaboration/CommentersSorter.php
@@ -28,8 +28,7 @@ use OCP\Comments\ICommentsManager;
class CommentersSorter implements ISorter {
- /** @var ICommentsManager */
- private $commentsManager;
+ private ICommentsManager $commentsManager;
public function __construct(ICommentsManager $commentsManager) {
$this->commentsManager = $commentsManager;
@@ -77,12 +76,7 @@ class CommentersSorter implements ISorter {
}
}
- /**
- * @param $type
- * @param $id
- * @return array
- */
- protected function retrieveCommentsInformation($type, $id) {
+ protected function retrieveCommentsInformation(string $type, string $id): array {
$comments = $this->commentsManager->getForObject($type, $id);
if (count($comments) === 0) {
return [];
@@ -102,12 +96,12 @@ class CommentersSorter implements ISorter {
return $actors;
}
- protected function compare(array $a, array $b, array $commenters) {
+ protected function compare(array $a, array $b, array $commenters): int {
$a = $a['value']['shareWith'];
$b = $b['value']['shareWith'];
- $valueA = isset($commenters[$a]) ? $commenters[$a] : 0;
- $valueB = isset($commenters[$b]) ? $commenters[$b] : 0;
+ $valueA = $commenters[$a] ?? 0;
+ $valueB = $commenters[$b] ?? 0;
return $valueB - $valueA;
}