From 0f1be1b60150cc92e7616834d58271ffddc19762 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Mon, 7 Dec 2015 20:08:20 +0000 Subject: [PATCH 1/2] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- apps/files_sharing/lib/sharedmount.php | 5 +++++ apps/files_sharing/tests/api/shareestest.php | 7 +++++++ apps/files_sharing/tests/share.php | 4 ++++ apps/files_trashbin/lib/trashbin.php | 13 +++++++------ apps/files_trashbin/tests/trashbin.php | 19 ++++++++++++++++--- apps/files_versions/lib/storage.php | 2 +- apps/provisioning_api/tests/groupstest.php | 6 ++++++ 7 files changed, 46 insertions(+), 10 deletions(-) diff --git a/apps/files_sharing/lib/sharedmount.php b/apps/files_sharing/lib/sharedmount.php index 275fea97c7..0581e28151 100644 --- a/apps/files_sharing/lib/sharedmount.php +++ b/apps/files_sharing/lib/sharedmount.php @@ -48,6 +48,11 @@ class SharedMount extends MountPoint implements MoveableMount { */ private $user; + /** + * @param string $storage + * @param string $mountpoint + * @param \OCP\Files\Storage\IStorageFactory $loader + */ public function __construct($storage, $mountpoint, $arguments = null, $loader = null) { $this->user = $arguments['user']; $this->recipientView = new View('/' . $this->user . '/files'); diff --git a/apps/files_sharing/tests/api/shareestest.php b/apps/files_sharing/tests/api/shareestest.php index a3e3a6dee6..1e49a843ae 100644 --- a/apps/files_sharing/tests/api/shareestest.php +++ b/apps/files_sharing/tests/api/shareestest.php @@ -88,6 +88,10 @@ class ShareesTest extends TestCase { ); } + /** + * @param string $uid + * @param string $displayName + */ protected function getUserMock($uid, $displayName) { $user = $this->getMockBuilder('OCP\IUser') ->disableOriginalConstructor() @@ -104,6 +108,9 @@ class ShareesTest extends TestCase { return $user; } + /** + * @param string $gid + */ protected function getGroupMock($gid) { $group = $this->getMockBuilder('OCP\IGroup') ->disableOriginalConstructor() diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php index b5ba0e3ad5..05013ad2e0 100644 --- a/apps/files_sharing/tests/share.php +++ b/apps/files_sharing/tests/share.php @@ -220,6 +220,10 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { } + /** + * @param OC\Files\FileInfo[] $content + * @param string[] $expected + */ public function verifyDirContent($content, $expected) { foreach ($content as $c) { if (!in_array($c['name'], $expected)) { diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 676252e163..bd6798f0ef 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -147,7 +147,7 @@ class Trashbin { * * @param string $sourcePath * @param string $owner - * @param $targetPath + * @param string $targetPath * @param $user * @param integer $timestamp */ @@ -410,7 +410,7 @@ class Trashbin { * @param string $uniqueFilename new file name to restore the file without overwriting existing files * @param string $location location if file * @param int $timestamp deletion time - * @return bool + * @return false|null */ private static function restoreVersions(\OC\Files\View $view, $file, $filename, $uniqueFilename, $location, $timestamp) { @@ -500,9 +500,10 @@ class Trashbin { /** * @param \OC\Files\View $view - * @param $file - * @param $filename - * @param $timestamp + * @param string $file + * @param string $filename + * @param integer|null $timestamp + * @param string $user * @return int */ private static function deleteVersions(\OC\Files\View $view, $file, $filename, $timestamp, $user) { @@ -684,7 +685,7 @@ class Trashbin { * * @param array $files list of files sorted by mtime * @param string $user - * @return array size of deleted files and number of deleted files + * @return integer[] size of deleted files and number of deleted files */ public static function deleteExpiredFiles($files, $user) { $application = new Application(); diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php index c53ed8d8a9..db7e7e6e84 100644 --- a/apps/files_trashbin/tests/trashbin.php +++ b/apps/files_trashbin/tests/trashbin.php @@ -248,8 +248,8 @@ class Test_Trashbin extends \Test\TestCase { /** * verify that the array contains the expected results - * @param array $result - * @param array $expected + * @param OCP\Files\FileInfo[] $result + * @param string[] $expected */ private function verifyArray($result, $expected) { $this->assertSame(count($expected), count($result)); @@ -268,6 +268,11 @@ class Test_Trashbin extends \Test\TestCase { } } + /** + * @param OCP\Files\FileInfo[] $files + * @param string $trashRoot + * @param integer $expireDate + */ private function manipulateDeleteTime($files, $trashRoot, $expireDate) { $counter = 0; foreach ($files as &$file) { @@ -627,7 +632,6 @@ class Test_Trashbin extends \Test\TestCase { /** * @param string $user * @param bool $create - * @param bool $password */ public static function loginHelper($user, $create = false) { if ($create) { @@ -650,11 +654,20 @@ class Test_Trashbin extends \Test\TestCase { // just a dummy class to make protected methods available for testing class TrashbinForTesting extends Files_Trashbin\Trashbin { + + /** + * @param OCP\Files\FileInfo[] $files + * @param integer $limit + */ public function dummyDeleteExpiredFiles($files, $limit) { // dummy value for $retention_obligation because it is not needed here return parent::deleteExpiredFiles($files, \Test_Trashbin::TEST_TRASHBIN_USER1, $limit, 0); } + /** + * @param OCP\Files\FileInfo[] $files + * @param integer $availableSpace + */ public function dummyDeleteFiles($files, $availableSpace) { return parent::deleteFiles($files, \Test_Trashbin::TEST_TRASHBIN_USER1, $availableSpace); } diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 6737bf20f9..29876b3e38 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -649,7 +649,7 @@ class Storage { /** * Expire versions which exceed the quota * - * @param $filename + * @param string $filename * @param int|null $versionsSize * @param int $offset * @return bool|int|null diff --git a/apps/provisioning_api/tests/groupstest.php b/apps/provisioning_api/tests/groupstest.php index d37f4412e2..f21c217e67 100644 --- a/apps/provisioning_api/tests/groupstest.php +++ b/apps/provisioning_api/tests/groupstest.php @@ -58,6 +58,9 @@ class GroupsTest extends \Test\TestCase { ); } + /** + * @param string $gid + */ private function createGroup($gid) { $group = $this->getMock('OCP\IGroup'); $group @@ -66,6 +69,9 @@ class GroupsTest extends \Test\TestCase { return $group; } + /** + * @param string $uid + */ private function createUser($uid) { $user = $this->getMock('OCP\IUser'); $user From 5453daab03effb4f94a1da73d05fae5896226cf8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 8 Dec 2015 09:11:50 +0100 Subject: [PATCH 2/2] More fixes to the docs --- apps/files_sharing/lib/sharedmount.php | 14 ++++++++++++-- apps/files_sharing/tests/api/shareestest.php | 2 ++ apps/provisioning_api/tests/groupstest.php | 10 ++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/apps/files_sharing/lib/sharedmount.php b/apps/files_sharing/lib/sharedmount.php index 0581e28151..f205b1e78a 100644 --- a/apps/files_sharing/lib/sharedmount.php +++ b/apps/files_sharing/lib/sharedmount.php @@ -51,6 +51,7 @@ class SharedMount extends MountPoint implements MoveableMount { /** * @param string $storage * @param string $mountpoint + * @param array|null $arguments * @param \OCP\Files\Storage\IStorageFactory $loader */ public function __construct($storage, $mountpoint, $arguments = null, $loader = null) { @@ -64,6 +65,9 @@ class SharedMount extends MountPoint implements MoveableMount { /** * check if the parent folder exists otherwise move the mount point up + * + * @param array $share + * @return string */ private function verifyMountPoint(&$share) { @@ -126,6 +130,7 @@ class SharedMount extends MountPoint implements MoveableMount { * * @param string $path the absolute path * @return string e.g. turns '/admin/files/test.txt' into '/test.txt' + * @throws \OCA\Files_Sharing\Exceptions\BrokenPath */ protected function stripUserFilesPath($path) { $trimmed = ltrim($path, '/'); @@ -188,7 +193,7 @@ class SharedMount extends MountPoint implements MoveableMount { */ public function removeMount() { $mountManager = \OC\Files\Filesystem::getMountManager(); - /** @var \OC\Files\Storage\Shared */ + /** @var $storage \OC\Files\Storage\Shared */ $storage = $this->getStorage(); $result = $storage->unshareStorage(); $mountManager->removeMount($this->mountPoint); @@ -196,7 +201,12 @@ class SharedMount extends MountPoint implements MoveableMount { return $result; } + /** + * @return array + */ public function getShare() { - return $this->getStorage()->getShare(); + /** @var $storage \OC\Files\Storage\Shared */ + $storage = $this->getStorage(); + return $storage->getShare(); } } diff --git a/apps/files_sharing/tests/api/shareestest.php b/apps/files_sharing/tests/api/shareestest.php index 1e49a843ae..96ffe4682c 100644 --- a/apps/files_sharing/tests/api/shareestest.php +++ b/apps/files_sharing/tests/api/shareestest.php @@ -91,6 +91,7 @@ class ShareesTest extends TestCase { /** * @param string $uid * @param string $displayName + * @return \OCP\IUser|\PHPUnit_Framework_MockObject_MockObject */ protected function getUserMock($uid, $displayName) { $user = $this->getMockBuilder('OCP\IUser') @@ -110,6 +111,7 @@ class ShareesTest extends TestCase { /** * @param string $gid + * @return \OCP\IGroup|\PHPUnit_Framework_MockObject_MockObject */ protected function getGroupMock($gid) { $group = $this->getMockBuilder('OCP\IGroup') diff --git a/apps/provisioning_api/tests/groupstest.php b/apps/provisioning_api/tests/groupstest.php index f21c217e67..f4f3b19494 100644 --- a/apps/provisioning_api/tests/groupstest.php +++ b/apps/provisioning_api/tests/groupstest.php @@ -30,13 +30,13 @@ use OCP\IUserSession; use OCP\IRequest; class GroupsTest extends \Test\TestCase { - /** @var IGroupManager */ + /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */ protected $groupManager; - /** @var IUserSession */ + /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */ protected $userSession; - /** @var IRequest */ + /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */ protected $request; - /** @var \OC\SubAdmin */ + /** @var \OC\SubAdmin|\PHPUnit_Framework_MockObject_MockObject */ protected $subAdminManager; /** @var \OCA\Provisioning_API\Groups */ protected $api; @@ -60,6 +60,7 @@ class GroupsTest extends \Test\TestCase { /** * @param string $gid + * @return \OCP\IGroup|\PHPUnit_Framework_MockObject_MockObject */ private function createGroup($gid) { $group = $this->getMock('OCP\IGroup'); @@ -71,6 +72,7 @@ class GroupsTest extends \Test\TestCase { /** * @param string $uid + * @return \OCP\IUser|\PHPUnit_Framework_MockObject_MockObject */ private function createUser($uid) { $user = $this->getMock('OCP\IUser');