Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 11:30:18 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 18:34:56 +0300
commitb80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch)
treeec20e0ffa2f86b9b54939a83a785407319f94559 /apps/files_sharing
parent62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff)
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php2
-rw-r--r--apps/files_sharing/lib/External/Manager.php26
-rw-r--r--apps/files_sharing/lib/External/Storage.php4
-rw-r--r--apps/files_sharing/lib/ShareBackend/File.php20
-rw-r--r--apps/files_sharing/lib/ShareBackend/Folder.php10
-rw-r--r--apps/files_sharing/lib/SharedStorage.php4
-rw-r--r--apps/files_sharing/public.php2
-rw-r--r--apps/files_sharing/templates/public.php2
-rw-r--r--apps/files_sharing/tests/ApiTest.php16
-rw-r--r--apps/files_sharing/tests/CacheTest.php180
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php8
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php12
-rw-r--r--apps/files_sharing/tests/External/CacheTest.php12
-rw-r--r--apps/files_sharing/tests/ExternalStorageTest.php32
-rw-r--r--apps/files_sharing/tests/ShareTest.php14
-rw-r--r--apps/files_sharing/tests/SharedMountTest.php16
-rw-r--r--apps/files_sharing/tests/SharedStorageTest.php6
-rw-r--r--apps/files_sharing/tests/WatcherTest.php10
18 files changed, 188 insertions, 188 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index 620aaf42c69..1022788ed2f 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -615,7 +615,7 @@ class ShareController extends AuthPublicShareController {
$this->emitAccessShareHook($share);
- $server_params = array( 'head' => $this->request->getMethod() === 'HEAD' );
+ $server_params = [ 'head' => $this->request->getMethod() === 'HEAD' ];
/**
* Http range requests support
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index c58e6e7b98a..c89bb2c2f4f 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -193,13 +193,13 @@ class Manager {
$this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType);
- $options = array(
+ $options = [
'remote' => $remote,
'token' => $token,
'password' => $password,
'mountpoint' => $mountPoint,
'owner' => $owner
- );
+ ];
return $this->mountShare($options);
}
@@ -226,7 +226,7 @@ class Manager {
(`remote`, `share_token`, `password`, `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`, `accepted`, `remote_id`, `parent`, `share_type`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
');
- return $query->execute(array($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType));
+ return $query->execute([$remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType]);
}
/**
@@ -240,7 +240,7 @@ class Manager {
SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`, `parent`, `share_type`, `password`, `mountpoint_hash`
FROM `*PREFIX*share_external`
WHERE `id` = ?');
- $result = $getShare->execute(array($id));
+ $result = $getShare->execute([$id]);
$share = $result ? $getShare->fetch() : [];
@@ -286,7 +286,7 @@ class Manager {
`mountpoint` = ?,
`mountpoint_hash` = ?
WHERE `id` = ? AND `user` = ?');
- $userShareAccepted = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
+ $userShareAccepted = $acceptShare->execute([1, $mountPoint, $hash, $id, $this->uid]);
} else {
$result = $this->writeShareToDb(
$share['remote'],
@@ -327,7 +327,7 @@ class Manager {
if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_USER) {
$removeShare = $this->connection->prepare('
DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?');
- $removeShare->execute(array($id, $this->uid));
+ $removeShare->execute([$id, $this->uid]);
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline');
$this->processNotification($id);
@@ -384,7 +384,7 @@ class Manager {
$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
$url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT;
- $fields = array('token' => $token);
+ $fields = ['token' => $token];
$client = $this->clientService->newClient();
@@ -502,7 +502,7 @@ class Manager {
WHERE `mountpoint_hash` = ?
AND `user` = ?
');
- $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $this->uid));
+ $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]);
return $result;
}
@@ -519,7 +519,7 @@ class Manager {
SELECT `remote`, `share_token`, `remote_id`, `share_type`, `id`
FROM `*PREFIX*share_external`
WHERE `mountpoint_hash` = ? AND `user` = ?');
- $result = $getShare->execute(array($hash, $this->uid));
+ $result = $getShare->execute([$hash, $this->uid]);
$share = $getShare->fetch();
$getShare->closeCursor();
@@ -535,13 +535,13 @@ class Manager {
DELETE FROM `*PREFIX*share_external`
WHERE `id` = ?
');
- $result = (bool)$query->execute(array((int)$share['id']));
+ $result = (bool)$query->execute([(int)$share['id']]);
} else if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) {
$query = $this->connection->prepare('
UPDATE `*PREFIX*share_external`
SET `accepted` = ?
WHERE `id` = ?');
- $result = (bool)$query->execute(array(0, (int)$share['id']));
+ $result = (bool)$query->execute([0, (int)$share['id']]);
}
if($result) {
@@ -585,7 +585,7 @@ class Manager {
SELECT `remote`, `share_token`, `remote_id`
FROM `*PREFIX*share_external`
WHERE `user` = ?');
- $result = $getShare->execute(array($uid));
+ $result = $getShare->execute([$uid]);
if ($result) {
$shares = $getShare->fetchAll();
@@ -598,7 +598,7 @@ class Manager {
DELETE FROM `*PREFIX*share_external`
WHERE `user` = ?
');
- return (bool)$query->execute(array($uid));
+ return (bool)$query->execute([$uid]);
}
/**
diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php
index 97870f73343..e405d8c4472 100644
--- a/apps/files_sharing/lib/External/Storage.php
+++ b/apps/files_sharing/lib/External/Storage.php
@@ -85,13 +85,13 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage {
$this->mountPoint = $options['mountpoint'];
$this->token = $options['token'];
- parent::__construct(array(
+ parent::__construct([
'secure' => $secure,
'host' => $host,
'root' => $root,
'user' => $options['token'],
'password' => (string)$options['password']
- ));
+ ]);
}
public function getWatcher($path = '', $storage = null) {
diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php
index a3a041142eb..7bde5979ce1 100644
--- a/apps/files_sharing/lib/ShareBackend/File.php
+++ b/apps/files_sharing/lib/ShareBackend/File.php
@@ -117,7 +117,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
}
}
- $excludeList = is_array($exclude) ? $exclude : array();
+ $excludeList = is_array($exclude) ? $exclude : [];
return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view);
}
@@ -126,17 +126,17 @@ class File implements \OCP\Share_Backend_File_Dependent {
if ($format === self::FORMAT_SHARED_STORAGE) {
// Only 1 item should come through for this format call
$item = array_shift($items);
- return array(
+ return [
'parent' => $item['parent'],
'path' => $item['path'],
'storage' => $item['storage'],
'permissions' => $item['permissions'],
'uid_owner' => $item['uid_owner'],
- );
+ ];
} else if ($format === self::FORMAT_GET_FOLDER_CONTENTS) {
- $files = array();
+ $files = [];
foreach ($items as $item) {
- $file = array();
+ $file = [];
$file['fileid'] = $item['file_source'];
$file['storage'] = $item['storage'];
$file['path'] = $item['file_target'];
@@ -157,31 +157,31 @@ class File implements \OCP\Share_Backend_File_Dependent {
}
return $files;
} else if ($format === self::FORMAT_OPENDIR) {
- $files = array();
+ $files = [];
foreach ($items as $item) {
$files[] = basename($item['file_target']);
}
return $files;
} else if ($format === self::FORMAT_GET_ALL) {
- $ids = array();
+ $ids = [];
foreach ($items as $item) {
$ids[] = $item['file_source'];
}
return $ids;
} else if ($format === self::FORMAT_PERMISSIONS) {
- $filePermissions = array();
+ $filePermissions = [];
foreach ($items as $item) {
$filePermissions[$item['file_source']] = $item['permissions'];
}
return $filePermissions;
} else if ($format === self::FORMAT_TARGET_NAMES) {
- $targets = array();
+ $targets = [];
foreach ($items as $item) {
$targets[] = $item['file_target'];
}
return $targets;
}
- return array();
+ return [];
}
/**
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php
index fd4bb2491fa..0c1ea18667c 100644
--- a/apps/files_sharing/lib/ShareBackend/Folder.php
+++ b/apps/files_sharing/lib/ShareBackend/Folder.php
@@ -39,7 +39,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
* @return array with shares
*/
public function getParents($itemSource, $shareWith = null, $owner = null) {
- $result = array();
+ $result = [];
$parent = $this->getParentId($itemSource);
$userManager = \OC::$server->getUserManager();
@@ -89,8 +89,8 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
}
public function getChildren($itemSource) {
- $children = array();
- $parents = array($itemSource);
+ $children = [];
+ $parents = [$itemSource];
$qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$qb->select('id')
@@ -123,9 +123,9 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
$result = $qb->execute();
- $parents = array();
+ $parents = [];
while ($file = $result->fetch()) {
- $children[] = array('source' => $file['fileid'], 'file_path' => $file['name']);
+ $children[] = ['source' => $file['fileid'], 'file_path' => $file['name']];
// If a child folder is found look inside it
if ((int) $file['mimetype'] === $mimetype) {
$parents[] = $file['fileid'];
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php
index 0baa36ac985..ea0163e80b2 100644
--- a/apps/files_sharing/lib/SharedStorage.php
+++ b/apps/files_sharing/lib/SharedStorage.php
@@ -285,11 +285,11 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
}
}
}
- $info = array(
+ $info = [
'target' => $this->getMountPoint() . $path,
'source' => $source,
'mode' => $mode,
- );
+ ];
\OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info);
return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode);
}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 1fcdf2fe505..99cdb882206 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -34,7 +34,7 @@ if ($token !== '') {
} else {
http_response_code(307);
}
- header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token)));
+ header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token]));
} else {
http_response_code(404);
$tmpl = new OCP\Template('', '404', 'guest');
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 792b4d23804..a9cfaae9df1 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -75,7 +75,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
<div class="directDownload">
<a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
<span class="icon icon-download"></span>
- <?php p($l->t('Download %s', array($_['filename'])))?> (<?php p($_['fileSize']) ?>)
+ <?php p($l->t('Download %s', [$_['filename']]))?> (<?php p($_['fileSize']) ?>)
</a>
</div>
<?php endif; ?>
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php
index c510c4dad98..a356525260f 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -648,12 +648,12 @@ class ApiTest extends TestCase {
$share3->setStatus(IShare::STATUS_ACCEPTED);
$this->shareManager->updateShare($share3);
- $testValues=array(
- array('query' => $this->folder,
- 'expectedResult' => $this->folder . $this->filename),
- array('query' => $this->folder . $this->subfolder,
- 'expectedResult' => $this->folder . $this->subfolder . $this->filename),
- );
+ $testValues=[
+ ['query' => $this->folder,
+ 'expectedResult' => $this->folder . $this->filename],
+ ['query' => $this->folder . $this->subfolder,
+ 'expectedResult' => $this->folder . $this->subfolder . $this->filename],
+ ];
foreach ($testValues as $value) {
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
@@ -1214,7 +1214,7 @@ class ApiTest extends TestCase {
*/
public static function initTestMountPointsHook($data) {
if ($data['user'] === self::TEST_FILES_SHARING_API_USER1) {
- \OC\Files\Filesystem::mount(self::$tempStorage, array(), '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME);
+ \OC\Files\Filesystem::mount(self::$tempStorage, [], '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME);
}
}
@@ -1222,7 +1222,7 @@ class ApiTest extends TestCase {
* Tests mounting a folder that is an external storage mount point.
*/
public function testShareStorageMountPoint() {
- $tempStorage = new \OC\Files\Storage\Temporary(array());
+ $tempStorage = new \OC\Files\Storage\Temporary([]);
$tempStorage->file_put_contents('test.txt', 'abcdef');
$tempStorage->getScanner()->scan('');
diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php
index 1c05e70f080..cba90e8f9e6 100644
--- a/apps/files_sharing/tests/CacheTest.php
+++ b/apps/files_sharing/tests/CacheTest.php
@@ -148,63 +148,63 @@ class CacheTest extends TestCase {
}
function searchDataProvider() {
- return array(
- array('%another%',
- array(
- array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
- array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
- )
- ),
- array('%Another%',
- array(
- array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
- array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
- )
- ),
- array('%dir%',
- array(
- array('name' => 'emptydir', 'path' => 'emptydir'),
- array('name' => 'subdir', 'path' => 'subdir'),
- array('name' => 'shareddir', 'path' => ''),
- )
- ),
- array('%Dir%',
- array(
- array('name' => 'emptydir', 'path' => 'emptydir'),
- array('name' => 'subdir', 'path' => 'subdir'),
- array('name' => 'shareddir', 'path' => ''),
- )
- ),
- array('%txt%',
- array(
- array('name' => 'bar.txt', 'path' => 'bar.txt'),
- array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
- array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
- )
- ),
- array('%Txt%',
- array(
- array('name' => 'bar.txt', 'path' => 'bar.txt'),
- array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
- array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
- )
- ),
- array('%',
- array(
- array('name' => 'bar.txt', 'path' => 'bar.txt'),
- array('name' => 'emptydir', 'path' => 'emptydir'),
- array('name' => 'subdir', 'path' => 'subdir'),
- array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
- array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
- array('name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'),
- array('name' => 'shareddir', 'path' => ''),
- )
- ),
- array('%nonexistent%',
- array(
- )
- ),
- );
+ return [
+ ['%another%',
+ [
+ ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'],
+ ['name' => 'another.txt', 'path' => 'subdir/another.txt'],
+ ]
+ ],
+ ['%Another%',
+ [
+ ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'],
+ ['name' => 'another.txt', 'path' => 'subdir/another.txt'],
+ ]
+ ],
+ ['%dir%',
+ [
+ ['name' => 'emptydir', 'path' => 'emptydir'],
+ ['name' => 'subdir', 'path' => 'subdir'],
+ ['name' => 'shareddir', 'path' => ''],
+ ]
+ ],
+ ['%Dir%',
+ [
+ ['name' => 'emptydir', 'path' => 'emptydir'],
+ ['name' => 'subdir', 'path' => 'subdir'],
+ ['name' => 'shareddir', 'path' => ''],
+ ]
+ ],
+ ['%txt%',
+ [
+ ['name' => 'bar.txt', 'path' => 'bar.txt'],
+ ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'],
+ ['name' => 'another.txt', 'path' => 'subdir/another.txt'],
+ ]
+ ],
+ ['%Txt%',
+ [
+ ['name' => 'bar.txt', 'path' => 'bar.txt'],
+ ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'],
+ ['name' => 'another.txt', 'path' => 'subdir/another.txt'],
+ ]
+ ],
+ ['%',
+ [
+ ['name' => 'bar.txt', 'path' => 'bar.txt'],
+ ['name' => 'emptydir', 'path' => 'emptydir'],
+ ['name' => 'subdir', 'path' => 'subdir'],
+ ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'],
+ ['name' => 'another.txt', 'path' => 'subdir/another.txt'],
+ ['name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'],
+ ['name' => 'shareddir', 'path' => ''],
+ ]
+ ],
+ ['%nonexistent%',
+ [
+ ]
+ ],
+ ];
}
/**
@@ -226,20 +226,20 @@ class CacheTest extends TestCase {
*/
function testSearchByMime() {
$results = $this->sharedStorage->getCache()->searchByMime('text');
- $check = array(
- array(
+ $check = [
+ [
'name' => 'bar.txt',
'path' => 'bar.txt'
- ),
- array(
+ ],
+ [
'name' => 'another too.txt',
'path' => 'subdir/another too.txt'
- ),
- array(
+ ],
+ [
'name' => 'another.txt',
'path' => 'subdir/another.txt'
- ),
- );
+ ],
+ ];
$this->verifyFiles($check, $results);
}
@@ -250,27 +250,27 @@ class CacheTest extends TestCase {
// additional root will always contain the example file "welcome.txt",
// so this will be part of the result
$this->verifyFiles(
- array(
- array(
+ [
+ [
'name' => 'welcome.txt',
'path' => 'files/welcome.txt',
'mimetype' => 'text/plain',
- ),
- array(
+ ],
+ [
'name' => 'shareddir',
'path' => 'files/shareddir',
'mimetype' => 'httpd/unix-directory',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- array(
+ ],
+ [
'name' => 'shared single file.txt',
'path' => 'files/shared single file.txt',
'mimetype' => 'text/plain',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- ),
+ ],
+ ],
$results
);
}
@@ -279,29 +279,29 @@ class CacheTest extends TestCase {
$results = $this->user2View->getDirectoryContent('/shareddir');
$this->verifyFiles(
- array(
- array(
+ [
+ [
'name' => 'bar.txt',
'path' => 'bar.txt',
'mimetype' => 'text/plain',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- array(
+ ],
+ [
'name' => 'emptydir',
'path' => 'emptydir',
'mimetype' => 'httpd/unix-directory',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- array(
+ ],
+ [
'name' => 'subdir',
'path' => 'subdir',
'mimetype' => 'httpd/unix-directory',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- ),
+ ],
+ ],
$results
);
}
@@ -327,29 +327,29 @@ class CacheTest extends TestCase {
$results = $thirdView->getDirectoryContent('/subdir');
$this->verifyFiles(
- array(
- array(
+ [
+ [
'name' => 'another too.txt',
'path' => 'another too.txt',
'mimetype' => 'text/plain',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- array(
+ ],
+ [
'name' => 'another.txt',
'path' => 'another.txt',
'mimetype' => 'text/plain',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- array(
+ ],
+ [
'name' => 'not a text file.xml',
'path' => 'not a text file.xml',
'mimetype' => 'application/xml',
'uid_owner' => self::TEST_FILES_SHARING_API_USER1,
'displayname_owner' => 'User One',
- ),
- ),
+ ],
+ ],
$results
);
@@ -376,7 +376,7 @@ class CacheTest extends TestCase {
}
}
}
- $this->assertEquals(array(), $results);
+ $this->assertEquals([], $results);
}
/**
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 69b00ff9424..e8fb3454e1e 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -1525,7 +1525,7 @@ class ShareAPIControllerTest extends TestCase {
->willReturn(true);
$helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController')
- ->setMethods(array('canAccessShare'))
+ ->setMethods(['canAccessShare'])
->getMock();
$helper->method('canAccessShare')
->with($share, $this->currentUser)
@@ -2170,7 +2170,7 @@ class ShareAPIControllerTest extends TestCase {
->willReturn(true);
$helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController')
- ->setMethods(array('createShare'))
+ ->setMethods(['createShare'])
->getMock();
$helper->method('createShare')
->with(
@@ -2293,7 +2293,7 @@ class ShareAPIControllerTest extends TestCase {
->willReturn(true);
$helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController')
- ->setMethods(array('createShare'))
+ ->setMethods(['createShare'])
->getMock();
$helper->method('createShare')
->with(
@@ -4291,7 +4291,7 @@ class ShareAPIControllerTest extends TestCase {
->willReturn(true);
$helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController')
- ->setMethods(array('formatShare'))
+ ->setMethods(['formatShare'])
->getMock();
$helper->method('formatShare')
->with($share)
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index 35807dffe82..c560595a7b4 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -287,7 +287,7 @@ class ShareControllerTest extends \Test\TestCase {
});
$response = $this->shareController->showShare();
- $sharedTmplParams = array(
+ $sharedTmplParams = [
'displayName' => 'ownerDisplay',
'owner' => 'ownerUID',
'filename' => 'file1.txt',
@@ -315,7 +315,7 @@ class ShareControllerTest extends \Test\TestCase {
'note' => $note,
'hideDownload' => false,
'showgridview' => false
- );
+ ];
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
@@ -427,7 +427,7 @@ class ShareControllerTest extends \Test\TestCase {
});
$response = $this->shareController->showShare();
- $sharedTmplParams = array(
+ $sharedTmplParams = [
'displayName' => 'ownerDisplay',
'owner' => 'ownerUID',
'filename' => 'file1.txt',
@@ -455,7 +455,7 @@ class ShareControllerTest extends \Test\TestCase {
'note' => $note,
'hideDownload' => true,
'showgridview' => false
- );
+ ];
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
@@ -541,7 +541,7 @@ class ShareControllerTest extends \Test\TestCase {
unset($responseParams['folder']);
$response->setParams($responseParams);
- $sharedTmplParams = array(
+ $sharedTmplParams = [
'displayName' => 'ownerDisplay',
'owner' => 'ownerUID',
'filename' => '/fileDrop',
@@ -569,7 +569,7 @@ class ShareControllerTest extends \Test\TestCase {
'note' => '',
'hideDownload' => false,
'showgridview' => false
- );
+ ];
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php
index 766f0232b87..42cd05ebdf4 100644
--- a/apps/files_sharing/tests/External/CacheTest.php
+++ b/apps/files_sharing/tests/External/CacheTest.php
@@ -76,11 +76,11 @@ class CacheTest extends TestCase {
);
$this->cache->put(
'test.txt',
- array(
+ [
'mimetype' => 'text/plain',
'size' => 5,
'mtime' => 123,
- )
+ ]
);
}
@@ -107,19 +107,19 @@ class CacheTest extends TestCase {
public function testGetFolderPopulatesOwner() {
$dirId = $this->cache->put(
'subdir',
- array(
+ [
'mimetype' => 'httpd/unix-directory',
'size' => 5,
'mtime' => 123,
- )
+ ]
);
$this->cache->put(
'subdir/contents.txt',
- array(
+ [
'mimetype' => 'text/plain',
'size' => 5,
'mtime' => 123,
- )
+ ]
);
$results = $this->cache->getFolderContentsById($dirId);
diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php
index b4e84846ed4..2a9577bccb9 100644
--- a/apps/files_sharing/tests/ExternalStorageTest.php
+++ b/apps/files_sharing/tests/ExternalStorageTest.php
@@ -39,37 +39,37 @@ use OCP\Http\Client\IResponse;
class ExternalStorageTest extends \Test\TestCase {
function optionsProvider() {
- return array(
- array(
+ return [
+ [
'http://remoteserver:8080/owncloud',
'http://remoteserver:8080/owncloud/public.php/webdav/',
- ),
+ ],
// extra slash
- array(
+ [
'http://remoteserver:8080/owncloud/',
'http://remoteserver:8080/owncloud/public.php/webdav/',
- ),
+ ],
// extra path
- array(
+ [
'http://remoteserver:8080/myservices/owncloud/',
'http://remoteserver:8080/myservices/owncloud/public.php/webdav/',
- ),
+ ],
// root path
- array(
+ [
'http://remoteserver:8080/',
'http://remoteserver:8080/public.php/webdav/',
- ),
+ ],
// without port
- array(
+ [
'http://remoteserver/oc.test',
'http://remoteserver/oc.test/public.php/webdav/',
- ),
+ ],
// https
- array(
+ [
'https://remoteserver/',
'https://remoteserver/public.php/webdav/',
- ),
- );
+ ],
+ ];
}
private function getTestStorage($uri) {
@@ -91,7 +91,7 @@ class ExternalStorageTest extends \Test\TestCase {
->willReturn($client);
return new TestSharingExternalStorage(
- array(
+ [
'cloudId' => new CloudId('testOwner@' . $uri, 'testOwner', $uri),
'remote' => $uri,
'owner' => 'testOwner',
@@ -101,7 +101,7 @@ class ExternalStorageTest extends \Test\TestCase {
'manager' => null,
'certificateManager' => $certificateManager,
'HttpClientService' => $httpClientService,
- )
+ ]
);
}
diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php
index 50859984133..dddeb5cf551 100644
--- a/apps/files_sharing/tests/ShareTest.php
+++ b/apps/files_sharing/tests/ShareTest.php
@@ -226,13 +226,13 @@ class ShareTest extends TestCase {
$permission5 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE;
$permission6 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE;
- return array(
- array($permission1, false),
- array($permission3, true),
- array($permission4, true),
- array($permission5, false),
- array($permission6, false),
- );
+ return [
+ [$permission1, false],
+ [$permission3, true],
+ [$permission4, true],
+ [$permission5, false],
+ [$permission6, false],
+ ];
}
public function testFileOwner() {
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php
index 55abbd20cba..e63cb597950 100644
--- a/apps/files_sharing/tests/SharedMountTest.php
+++ b/apps/files_sharing/tests/SharedMountTest.php
@@ -251,14 +251,14 @@ class SharedMountTest extends TestCase {
}
public function dataProviderTestStripUserFilesPath() {
- return array(
- array('/user/files/foo.txt', '/foo.txt', false),
- array('/user/files/folder/foo.txt', '/folder/foo.txt', false),
- array('/data/user/files/foo.txt', null, true),
- array('/data/user/files/', null, true),
- array('/files/foo.txt', null, true),
- array('/foo.txt', null, true),
- );
+ return [
+ ['/user/files/foo.txt', '/foo.txt', false],
+ ['/user/files/folder/foo.txt', '/folder/foo.txt', false],
+ ['/data/user/files/foo.txt', null, true],
+ ['/data/user/files/', null, true],
+ ['/files/foo.txt', null, true],
+ ['/foo.txt', null, true],
+ ];
}
public function dataPermissionMovedGroupShare() {
diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php
index 59e411e47f7..1c222055d4e 100644
--- a/apps/files_sharing/tests/SharedStorageTest.php
+++ b/apps/files_sharing/tests/SharedStorageTest.php
@@ -406,7 +406,7 @@ class SharedStorageTest extends TestCase {
$mountConfigManager = \OC::$server->getMountProviderCollection();
$mounts = $mountConfigManager->getMountsForUser(\OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3));
- array_walk($mounts, array(\OC\Files\Filesystem::getMountManager(), 'addMount'));
+ array_walk($mounts, [\OC\Files\Filesystem::getMountManager(), 'addMount']);
$this->assertTrue($rootView->file_exists('/' . self::TEST_FILES_SHARING_API_USER3 . '/files/' . $this->filename));
@@ -443,7 +443,7 @@ class SharedStorageTest extends TestCase {
list($sharedStorage,) = $view->resolvePath($this->folder);
$this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));
- $sourceStorage = new \OC\Files\Storage\Temporary(array());
+ $sourceStorage = new \OC\Files\Storage\Temporary([]);
$sourceStorage->file_put_contents('foo.txt', 'asd');
$sharedStorage->copyFromStorage($sourceStorage, 'foo.txt', 'bar.txt');
@@ -476,7 +476,7 @@ class SharedStorageTest extends TestCase {
list($sharedStorage,) = $view->resolvePath($this->folder);
$this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));
- $sourceStorage = new \OC\Files\Storage\Temporary(array());
+ $sourceStorage = new \OC\Files\Storage\Temporary([]);
$sourceStorage->file_put_contents('foo.txt', 'asd');
$sharedStorage->moveFromStorage($sourceStorage, 'foo.txt', 'bar.txt');
diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php
index 093f6139dd3..0386828c4ca 100644
--- a/apps/files_sharing/tests/WatcherTest.php
+++ b/apps/files_sharing/tests/WatcherTest.php
@@ -115,9 +115,9 @@ class WatcherTest extends TestCase {
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$dataLen = strlen($textData);
- $this->sharedCache->put('bar.txt', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain'));
+ $this->sharedCache->put('bar.txt', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']);
$this->sharedStorage->file_put_contents('bar.txt', $textData);
- $this->sharedCache->put('', array('mtime' => 10, 'storage_mtime' => 10, 'size' => '-1', 'mimetype' => 'httpd/unix-directory'));
+ $this->sharedCache->put('', ['mtime' => 10, 'storage_mtime' => 10, 'size' => '-1', 'mimetype' => 'httpd/unix-directory']);
// run the propagation code
$this->sharedStorage->getWatcher()->checkUpdate('');
@@ -145,9 +145,9 @@ class WatcherTest extends TestCase {
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$dataLen = strlen($textData);
- $this->sharedCache->put('subdir/bar.txt', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain'));
+ $this->sharedCache->put('subdir/bar.txt', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']);
$this->sharedStorage->file_put_contents('subdir/bar.txt', $textData);
- $this->sharedCache->put('subdir', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain'));
+ $this->sharedCache->put('subdir', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']);
// run the propagation code
$this->sharedStorage->getWatcher()->checkUpdate('subdir');
@@ -173,7 +173,7 @@ class WatcherTest extends TestCase {
* @param string $path
*/
function getOwnerDirSizes($path) {
- $result = array();
+ $result = [];
while ($path != '' && $path != '' && $path != '.') {
$cachedData = $this->ownerCache->get($path);