summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-01-16 19:34:43 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-01-16 21:54:20 +0100
commit8edbfdb29173a97f6fd265bad234ec458b72bf40 (patch)
treedd44453cf41fae4d8453ce3738ae9c8dae57d619 /lib/public
parent13a787e2f5d22e4cd8204f4524ea3e2c4eba4d32 (diff)
downloadnextcloud-server-8edbfdb29173a97f6fd265bad234ec458b72bf40.tar.gz
nextcloud-server-8edbfdb29173a97f6fd265bad234ec458b72bf40.zip
Made locking providers strict
* Added typehints * Added return types * Made strict Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Lock/ILockingProvider.php9
-rw-r--r--lib/public/Lock/LockedException.php5
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/public/Lock/ILockingProvider.php b/lib/public/Lock/ILockingProvider.php
index 6fe9894b7b5..32e76c72531 100644
--- a/lib/public/Lock/ILockingProvider.php
+++ b/lib/public/Lock/ILockingProvider.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -45,7 +46,7 @@ interface ILockingProvider {
* @return bool
* @since 8.1.0
*/
- public function isLocked($path, $type);
+ public function isLocked(string $path, int $type): bool;
/**
* @param string $path
@@ -53,14 +54,14 @@ interface ILockingProvider {
* @throws \OCP\Lock\LockedException
* @since 8.1.0
*/
- public function acquireLock($path, $type);
+ public function acquireLock(string $path, int $type);
/**
* @param string $path
* @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
* @since 8.1.0
*/
- public function releaseLock($path, $type);
+ public function releaseLock(string $path, int $type);
/**
* Change the type of an existing lock
@@ -70,7 +71,7 @@ interface ILockingProvider {
* @throws \OCP\Lock\LockedException
* @since 8.1.0
*/
- public function changeLock($path, $targetType);
+ public function changeLock(string $path, int $targetType);
/**
* release all lock acquired by this instance
diff --git a/lib/public/Lock/LockedException.php b/lib/public/Lock/LockedException.php
index 5b5d88c18ca..1378f437c3a 100644
--- a/lib/public/Lock/LockedException.php
+++ b/lib/public/Lock/LockedException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -48,7 +49,7 @@ class LockedException extends \Exception {
*
* @since 8.1.0
*/
- public function __construct($path, \Exception $previous = null) {
+ public function __construct(string $path, \Exception $previous = null) {
parent::__construct('"' . $path . '" is locked', 0, $previous);
$this->path = $path;
}
@@ -57,7 +58,7 @@ class LockedException extends \Exception {
* @return string
* @since 8.1.0
*/
- public function getPath() {
+ public function getPath(): string {
return $this->path;
}
}