diff options
author | Joas Schilling <coding@schilljs.com> | 2019-02-12 18:07:59 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-02-12 18:07:59 +0300 |
commit | fb90a742312eb92898c56451757ebb3a5d916c88 (patch) | |
tree | fad13d0a9e8530e1a791a26d0086e1ee926d8e73 /lib/Files | |
parent | af59422720af0d69a29221d13b1b9b32063db603 (diff) |
Make all classes strict
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Files')
-rw-r--r-- | lib/Files/Listener.php | 7 | ||||
-rw-r--r-- | lib/Files/TemplateLoader.php | 11 | ||||
-rw-r--r-- | lib/Files/Util.php | 15 |
3 files changed, 10 insertions, 23 deletions
diff --git a/lib/Files/Listener.php b/lib/Files/Listener.php index 7c8427f5e..a4e6f6b44 100644 --- a/lib/Files/Listener.php +++ b/lib/Files/Listener.php @@ -1,6 +1,5 @@ <?php declare(strict_types=1); - /** * * @copyright Copyright (c) 2018, Daniel Calviño Sánchez (danxuliu@gmail.com) @@ -56,7 +55,7 @@ class Listener { $this->util = $util; } - public function register() { + public function register(): void { $listener = function(GenericEvent $event) { /** @var Room $room */ $room = $event->getSubject(); @@ -94,7 +93,7 @@ class Listener { * @param string $userId * @throws UnauthorizedException */ - public function preventUsersWithoutDirectAccessToTheFileFromJoining(Room $room, string $userId) { + public function preventUsersWithoutDirectAccessToTheFileFromJoining(Room $room, string $userId): void { if ($room->getObjectType() !== 'file') { return; } @@ -113,7 +112,7 @@ class Listener { * @param Room $room * @throws UnauthorizedException */ - public function preventGuestsFromJoining(Room $room) { + public function preventGuestsFromJoining(Room $room): void { if ($room->getObjectType() !== 'file') { return; } diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php index d3d0ba4a7..f06bfcad5 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -1,6 +1,5 @@ <?php declare(strict_types=1); - /** * * @copyright Copyright (c) 2018, Daniel Calviño Sánchez (danxuliu@gmail.com) @@ -26,7 +25,6 @@ namespace OCA\Spreed\Files; use OCP\Util; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Helper class to add the Talk UI to the sidebar of the Files app. @@ -40,11 +38,8 @@ class TemplateLoader { $this->dispatcher = $dispatcher; } - public function register() { - $listener = function() { - $this->loadTalkSidebarForFilesApp(); - }; - $this->dispatcher->addListener('OCA\Files::loadAdditionalScripts', $listener); + public function register(): void { + $this->dispatcher->addListener('OCA\Files::loadAdditionalScripts', [$this, 'loadTalkSidebarForFilesApp']); } /** @@ -53,7 +48,7 @@ class TemplateLoader { * This method should be called when loading additional scripts for the * Files app. */ - public function loadTalkSidebarForFilesApp() { + public static function loadTalkSidebarForFilesApp(): void { Util::addStyle('spreed', 'merged-files'); Util::addScript('spreed', 'merged-files'); } diff --git a/lib/Files/Util.php b/lib/Files/Util.php index e830378c6..bb4f20bce 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -1,6 +1,5 @@ <?php declare(strict_types=1); - /** * * @copyright Copyright (c) 2018, Daniel Calviño Sánchez (danxuliu@gmail.com) @@ -39,14 +38,8 @@ class Util { /** @var array[] */ private $accessLists = []; - /** - * @param IRootFolder $rootFolder - * @param IShareManager $shareManager - */ - public function __construct( - IRootFolder $rootFolder, - IShareManager $shareManager - ) { + public function __construct(IRootFolder $rootFolder, + IShareManager $shareManager) { $this->rootFolder = $rootFolder; $this->shareManager = $shareManager; } @@ -87,7 +80,7 @@ class Util { * @param string $userId * @return IShare|null */ - public function getAnyDirectShareOfFileAccessibleByUser(string $fileId, string $userId) { + public function getAnyDirectShareOfFileAccessibleByUser(string $fileId, string $userId): ?IShare { $userFolder = $this->rootFolder->getUserFolder($userId); $nodes = $userFolder->getById($fileId); if (empty($nodes)) { @@ -122,7 +115,7 @@ class Util { * @param string $userId * @return IShare|null */ - private function getAnyDirectShareOfNodeAccessibleByUser(Node $node, string $userId) { + private function getAnyDirectShareOfNodeAccessibleByUser(Node $node, string $userId): ?IShare { $reshares = false; $limit = 1; |