diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-05-24 20:46:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-24 20:46:23 +0200 |
commit | d6158c8aeacdf3dbf18180a6b3cfdfd1e0289a91 (patch) | |
tree | c846571ff457ab8e28a7f3a8bafb29392d338f5b /apps/dav | |
parent | a40b6ce9956d529e8c94726587a4139d6627b250 (diff) | |
parent | 3ada267a0224ac7b1fd642a5eb21a7be700c691a (diff) | |
download | nextcloud-server-d6158c8aeacdf3dbf18180a6b3cfdfd1e0289a91.tar.gz nextcloud-server-d6158c8aeacdf3dbf18180a6b3cfdfd1e0289a91.zip |
Merge pull request #32548 from nextcloud/fix/return-type
Fix return type and make type stricter
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index 4a1205e8606..eaa7f1bc2d2 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -115,30 +116,27 @@ class CommentPropertiesPlugin extends ServerPlugin { return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId()); }); - $propFind->handle(self::PROPERTY_NAME_HREF, function () use ($node) { + $propFind->handle(self::PROPERTY_NAME_HREF, function () use ($node): ?string { return $this->getCommentsLink($node); }); - $propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node): ?bool { + $propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node): ?int { return $this->cachedUnreadCount[$node->getId()] ?? $this->getUnreadCount($node); }); } /** * Returns a reference to the comments node - * - * @return array|string|null */ - public function getCommentsLink(Node $node) { + public function getCommentsLink(Node $node): ?string { $href = $this->server->getBaseUri(); $entryPoint = strpos($href, '/remote.php/'); if ($entryPoint === false) { // in case we end up somewhere else, unexpectedly. return null; } - $commentsPart = 'dav/comments/files/' . rawurldecode($node->getId()); - $href = substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/')); - return $href; + $commentsPart = 'dav/comments/files/' . rawurldecode((string)$node->getId()); + return substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/')); } /** |