diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index b81070d320238..65765df7c2266 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -180,7 +180,6 @@ public function createServer( $server->addPlugin(new SharesPlugin( $tree, $this->userSession, - $userFolder, \OCP\Server::get(\OCP\Share\IManager::class) )); $server->addPlugin(new CommentPropertiesPlugin(\OCP\Server::get(ICommentsManager::class), $this->userSession)); diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index 14254c4148796..5a4f187ef3c94 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -32,12 +32,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { public const SHARETYPES_PROPERTYNAME = '{http://owncloud.org/ns}share-types'; public const SHAREES_PROPERTYNAME = '{http://nextcloud.org/ns}sharees'; - /** - * Reference to main server object - * - * @var \Sabre\DAV\Server - */ - private $server; + private \Sabre\DAV\Server $server; private string $userId; /** @var IShare[][] */ @@ -54,8 +49,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { public function __construct( private Tree $tree, - private IUserSession $userSession, - private Folder $userFolder, + IUserSession $userSession, private IManager $shareManager, ) { $this->userId = $userSession->getUser()->getUID(); @@ -206,10 +200,7 @@ public function handleGetProperties( $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode): ShareTypeList { $shares = $this->getShares($sabreNode); - - $shareTypes = array_unique(array_map(function (IShare $share) { - return $share->getShareType(); - }, $shares)); + $shareTypes = array_unique(array_map(static fn (IShare $share): int => $share->getShareType(), $shares)); return new ShareTypeList($shareTypes); }); diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 6f362d9e19f68..a57526f1faca2 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -336,7 +336,6 @@ public function __construct( $this->server->addPlugin(new SharesPlugin( $this->server->tree, $userSession, - $userFolder, $shareManager, )); $this->server->addPlugin(new CommentPropertiesPlugin( diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index 66c9054a6fe95..9bbfa2591cd87 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -27,7 +27,6 @@ class SharesPluginTest extends \Test\TestCase { private \Sabre\DAV\Server $server; private \Sabre\DAV\Tree&MockObject $tree; private \OCP\Share\IManager&MockObject $shareManager; - private Folder&MockObject $userFolder; private SharesPlugin $plugin; protected function setUp(): void { @@ -43,12 +42,10 @@ protected function setUp(): void { $userSession->expects($this->once()) ->method('getUser') ->willReturn($user); - $this->userFolder = $this->createMock(Folder::class); $this->plugin = new SharesPlugin( $this->tree, $userSession, - $this->userFolder, $this->shareManager ); $this->plugin->initialize($this->server);