From d3b69597ed35a7a7e9f0ecff9c7f8d64397ae9db Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 2 May 2024 20:05:48 +0200 Subject: [PATCH 1/2] refactor: use constructor property promotion Fix "Creation of dynamic property OCA\\FilesLock\\DAV\\LockBackend::$server is deprecated" by removing it. Signed-off-by: Daniel Kesselberg --- lib/DAV/LockBackend.php | 19 +++---------------- lib/DAV/LockPlugin.php | 2 +- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/DAV/LockBackend.php b/lib/DAV/LockBackend.php index e6450a7b..b37e4b03 100644 --- a/lib/DAV/LockBackend.php +++ b/lib/DAV/LockBackend.php @@ -39,28 +39,15 @@ use OCP\Files\NotFoundException; use Sabre\DAV\Locks\Backend\BackendInterface; use Sabre\DAV\Locks\LockInfo; -use Sabre\DAV\Server; class LockBackend implements BackendInterface { - /** @var FileService */ - private $fileService; - - /** @var LockService */ - private $lockService; - - /** @var bool */ - private $absolute = false; - public function __construct( - Server $server, FileService $fileService, LockService $lockService, bool $absolute + private FileService $fileService, + private LockService $lockService, + private bool $absolute ) { - $this->server = $server; - $this->fileService = $fileService; - $this->lockService = $lockService; - $this->absolute = $absolute; } - /** * @param string $uri * @param bool $returnChildLocks diff --git a/lib/DAV/LockPlugin.php b/lib/DAV/LockPlugin.php index 93975923..61793f34 100644 --- a/lib/DAV/LockPlugin.php +++ b/lib/DAV/LockPlugin.php @@ -58,7 +58,7 @@ public function initialize(Server $server) { $absolute = true; break; } - $this->locksBackend = new LockBackend($server, $this->fileService, $this->lockService, $absolute); + $this->locksBackend = new LockBackend($this->fileService, $this->lockService, $absolute); $server->on('propFind', [$this, 'customProperties']); parent::initialize($server); } From 83cd06dfcad831ee0eb1567ab046fcae3014c358 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 2 May 2024 20:12:38 +0200 Subject: [PATCH 2/2] test: avoid deprecation warning "Creation of dynamic property LockFeatureTest::$shareManager is deprecate" Signed-off-by: Daniel Kesselberg --- tests/Feature/LockFeatureTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Feature/LockFeatureTest.php b/tests/Feature/LockFeatureTest.php index 37706d95..7616b872 100644 --- a/tests/Feature/LockFeatureTest.php +++ b/tests/Feature/LockFeatureTest.php @@ -30,6 +30,7 @@ use OCP\Files\Lock\ILockManager; use OCP\Files\Lock\LockContext; use OCP\Lock\ManuallyLockedException; +use OCP\Share\IManager as IShareManager; use OCP\Share\IShare; use Test\TestCase; use Test\Util\User\Dummy; @@ -43,6 +44,8 @@ class LockFeatureTest extends TestCase { private LockManager $lockManager; private IRootFolder $rootFolder; + private ITimeFactory $timeFactory; + private IShareManager $shareManager; private ?int $time = null; public static function setUpBeforeClass(): void {