Skip to content

Commit

Permalink
Use the short array syntax, everywhere
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Mar 26, 2020
1 parent 62403d0 commit b80ebc9
Show file tree
Hide file tree
Showing 454 changed files with 4,220 additions and 4,220 deletions.
8 changes: 4 additions & 4 deletions apps/accessibility/lib/AccessibilityProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public function __construct(string $appName,
}

public function getThemes() {
return array(
return [
[
'id' => 'dark',
'img' => $this->urlGenerator->imagePath($this->appName, 'theme-dark.jpg'),
'title' => $this->l->t('Dark theme'),
'enableLabel' => $this->l->t('Enable dark theme'),
'text' => $this->l->t('A dark theme to ease your eyes by reducing the overall luminosity and brightness. It is still under development, so please report any issues you may find.')
]
);
];
}

public function getHighContrast() {
Expand All @@ -79,15 +79,15 @@ public function getHighContrast() {
}

public function getFonts() {
return array(
return [
[
'id' => 'fontdyslexic',
'img' => $this->urlGenerator->imagePath($this->appName, 'font-opendyslexic.jpg'),
'title' => $this->l->t('Dyslexia font'),
'enableLabel' => $this->l->t('Enable dyslexia font'),
'text' => $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.')
]
);
];
}

}
2 changes: 1 addition & 1 deletion apps/accessibility/lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function setConfig(string $key, $value): DataResponse {
}

$themes = $this->accessibilityProvider->getThemes();
$highcontrast = array($this->accessibilityProvider->getHighContrast());
$highcontrast = [$this->accessibilityProvider->getHighContrast()];
$fonts = $this->accessibilityProvider->getFonts();

$availableOptions = array_map(function($option) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private function mapUid($uid) {
\OCP\Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
array('uid' => &$uid)
['uid' => &$uid]
);
$this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]);

Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Application extends App {

const APP_ID = 'comments';

public function __construct (array $urlParams = array()) {
public function __construct (array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
$container = $this->getContainer();

Expand Down
4 changes: 2 additions & 2 deletions apps/dav/appinfo/v1/caldav.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
$addressBookRoot = new CalendarRoot($principalBackend, $calDavBackend);
$addressBookRoot->disableListing = !$debugging; // Disable listing

$nodes = array(
$nodes = [
$principalCollection,
$addressBookRoot,
);
];

// Fire up server
$server = new \Sabre\DAV\Server($nodes);
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/appinfo/v1/carddav.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
$addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend, $pluginManager);
$addressBookRoot->disableListing = !$debugging; // Disable listing

$nodes = array(
$nodes = [
$principalCollection,
$addressBookRoot,
);
];

// Fire up server
$server = new \Sabre\DAV\Server($nodes);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/appinfo/v1/publicwebdav.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
$previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
\OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE));
return new \OC\Files\Storage\Wrapper\PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE]);
});

\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ function createSubscription($principalUri, $uri, array $properties) {
}
}

$valuesToInsert = array();
$valuesToInsert = [];

$query = $this->db->getQueryBuilder();

Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ public function schedule(Message $iTipMessage) {
break;
}

$data = array(
$data = [
'attendee_name' => (string)$meetingAttendeeName ?: $defaultVal,
'invitee_name' => (string)$meetingInviteeName ?: $defaultVal,
'meeting_title' => (string)$meetingTitle ?: $defaultVal,
'meeting_description' => (string)$meetingDescription ?: $defaultVal,
'meeting_url' => (string)$meetingUrl ?: $defaultVal,
);
];

$fromEMail = \OCP\Util::getDefaultEmailAddress('invitations-noreply');
$fromName = $l10n->t('%1$s via %2$s', [$senderName, $this->defaults->getName()]);
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
private $sharingBackend;

/** @var array properties to index */
public static $indexProperties = array(
public static $indexProperties = [
'BDAY', 'UID', 'N', 'FN', 'TITLE', 'ROLE', 'NOTE', 'NICKNAME',
'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO', 'CLOUD');
'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO', 'CLOUD'];

/**
* @var string[] Map of uid => display name
Expand Down Expand Up @@ -909,7 +909,7 @@ public function updateShares(IShareable $shareable, $add, $remove) {
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are
* @return array an array of contacts which are arrays of key-value-pairs
*/
public function search($addressBookId, $pattern, $searchProperties, $options = array()) {
public function search($addressBookId, $pattern, $searchProperties, $options = []) {
$query = $this->db->getQueryBuilder();
$query2 = $this->db->getQueryBuilder();

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct($app, IAppManager $appManager) {
public function initialize(\Sabre\DAV\Server $server) {

$this->server = $server;
$this->server->on('beforeMethod', array($this, 'checkAppEnabled'), 30);
$this->server->on('beforeMethod', [$this, 'checkAppEnabled'], 30);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct(ICommentsManager $commentsManager, IUserSession $use
*/
function initialize(\Sabre\DAV\Server $server) {
$this->server = $server;
$this->server->on('propFind', array($this, 'handleGetProperties'));
$this->server->on('propFind', [$this, 'handleGetProperties']);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function getChildren() {
throw new Locked();
}

$nodes = array();
$nodes = [];
foreach ($folderContent as $info) {
$node = $this->getChild($info->getName(), $info);
$nodes[] = $node;
Expand Down Expand Up @@ -336,13 +336,13 @@ public function getQuotaInfo() {
} else {
$free = $storageInfo['free'];
}
$this->quotaInfo = array(
$this->quotaInfo = [
$storageInfo['used'],
$free
);
];
return $this->quotaInfo;
} catch (\OCP\Files\StorageNotAvailableException $e) {
return array(0, 0);
return [0, 0];
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function __construct($loggerAppName, $logger) {
*/
public function initialize(\Sabre\DAV\Server $server) {

$server->on('exception', array($this, 'logException'), 10);
$server->on('exception', [$this, 'logException'], 10);
}

/**
Expand Down
24 changes: 12 additions & 12 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,20 +359,20 @@ private function emitPreHooks($exists, $path = null) {
$run = true;

if (!$exists) {
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_create, array(
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_create, [
\OC\Files\Filesystem::signal_param_path => $hookPath,
\OC\Files\Filesystem::signal_param_run => &$run,
));
]);
} else {
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_update, array(
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_update, [
\OC\Files\Filesystem::signal_param_path => $hookPath,
\OC\Files\Filesystem::signal_param_run => &$run,
));
]);
}
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_write, array(
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_write, [
\OC\Files\Filesystem::signal_param_path => $hookPath,
\OC\Files\Filesystem::signal_param_run => &$run,
));
]);
return $run;
}

Expand All @@ -385,17 +385,17 @@ private function emitPostHooks($exists, $path = null) {
}
$hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path));
if (!$exists) {
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, array(
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, [
\OC\Files\Filesystem::signal_param_path => $hookPath
));
]);
} else {
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_update, array(
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_update, [
\OC\Files\Filesystem::signal_param_path => $hookPath
));
]);
}
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, array(
\OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, [
\OC\Files\Filesystem::signal_param_path => $hookPath
));
]);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ public function initialize(\Sabre\DAV\Server $server) {
$server->protectedProperties = array_diff($server->protectedProperties, $allowedProperties);

$this->server = $server;
$this->server->on('propFind', array($this, 'handleGetProperties'));
$this->server->on('propPatch', array($this, 'handleUpdateProperties'));
$this->server->on('afterBind', array($this, 'sendFileIdHeader'));
$this->server->on('afterWriteContent', array($this, 'sendFileIdHeader'));
$this->server->on('propFind', [$this, 'handleGetProperties']);
$this->server->on('propPatch', [$this, 'handleUpdateProperties']);
$this->server->on('afterBind', [$this, 'sendFileIdHeader']);
$this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']);
$this->server->on('afterMethod:GET', [$this,'httpGet']);
$this->server->on('afterMethod:GET', array($this, 'handleDownloadToken'));
$this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']);
$this->server->on('afterResponse', function($request, ResponseInterface $response) {
$body = $response->getBody();
if (is_resource($body)) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function initialize(\Sabre\DAV\Server $server) {
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';

$this->server = $server;
$this->server->on('report', array($this, 'onReport'));
$this->server->on('report', [$this, 'onReport']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/MaintenancePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct(IConfig $config = null) {
*/
public function initialize(\Sabre\DAV\Server $server) {
$this->server = $server;
$this->server->on('beforeMethod', array($this, 'checkMaintenanceMode'), 1);
$this->server->on('beforeMethod', [$this, 'checkMaintenanceMode'], 1);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/Connector/Sabre/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ public function getETag() {
* @return int file id of updated file or -1 on failure
*/
public function setETag($etag) {
return $this->fileView->putFileInfo($this->path, array('etag' => $etag));
return $this->fileView->putFileInfo($this->path, ['etag' => $etag]);
}

public function setCreationTime(int $time) {
return $this->fileView->putFileInfo($this->path, array('creation_time' => $time));
return $this->fileView->putFileInfo($this->path, ['creation_time' => $time]);
}

public function setUploadTime(int $time) {
return $this->fileView->putFileInfo($this->path, array('upload_time' => $time));
return $this->fileView->putFileInfo($this->path, ['upload_time' => $time]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/SharesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function initialize(\Sabre\DAV\Server $server) {
$server->protectedProperties[] = self::SHAREES_PROPERTYNAME;

$this->server = $server;
$this->server->on('propFind', array($this, 'handleGetProperties'));
$this->server->on('propFind', [$this, 'handleGetProperties']);
}

private function getShare(\OCP\Files\Node $node): array {
Expand Down
14 changes: 7 additions & 7 deletions apps/dav/lib/Connector/Sabre/TagsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function __construct(\Sabre\DAV\Tree $tree, \OCP\ITagManager $tagManager)
$this->tree = $tree;
$this->tagManager = $tagManager;
$this->tagger = null;
$this->cachedTags = array();
$this->cachedTags = [];
}

/**
Expand All @@ -118,8 +118,8 @@ public function initialize(\Sabre\DAV\Server $server) {
$server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class;

$this->server = $server;
$this->server->on('propFind', array($this, 'handleGetProperties'));
$this->server->on('propPatch', array($this, 'handleUpdateProperties'));
$this->server->on('propFind', [$this, 'handleGetProperties']);
$this->server->on('propPatch', [$this, 'handleUpdateProperties']);
}

/**
Expand Down Expand Up @@ -151,7 +151,7 @@ private function getTagsAndFav($fileId) {
unset($tags[$favPos]);
}
}
return array($tags, $isFav);
return [$tags, $isFav];
}

/**
Expand All @@ -164,10 +164,10 @@ private function getTags($fileId) {
if (isset($this->cachedTags[$fileId])) {
return $this->cachedTags[$fileId];
} else {
$tags = $this->getTagger()->getTagsForObjects(array($fileId));
$tags = $this->getTagger()->getTagsForObjects([$fileId]);
if ($tags !== false) {
if (empty($tags)) {
return array();
return [];
}
return current($tags);
}
Expand Down Expand Up @@ -232,7 +232,7 @@ public function handleGetProperties(
$tags = $this->getTagger()->getTagsForObjects($fileIds);
if ($tags === false) {
// the tags API returns false on error...
$tags = array();
$tags = [];
}

$this->cachedTags = $this->cachedTags + $tags;
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Files/BrowserErrorPagePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BrowserErrorPagePlugin extends ServerPlugin {
*/
function initialize(Server $server) {
$this->server = $server;
$server->on('exception', array($this, 'logException'), 1000);
$server->on('exception', [$this, 'logException'], 1000);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function removeOrphanChildren($childTable, $parentTable, $parentId): i

$result = $qb->execute();

$orphanItems = array();
$orphanItems = [];
while ($row = $result->fetch()) {
$orphanItems[] = (int) $row['id'];
}
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/SystemTag/SystemTagPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public function initialize(\Sabre\DAV\Server $server) {

$server->protectedProperties[] = self::ID_PROPERTYNAME;

$server->on('propFind', array($this, 'handleGetProperties'));
$server->on('propPatch', array($this, 'handleUpdateProperties'));
$server->on('propFind', [$this, 'handleGetProperties']);
$server->on('propPatch', [$this, 'handleUpdateProperties']);
$server->on('method:POST', [$this, 'httpPost']);

$this->server = $server;
Expand Down
Loading

0 comments on commit b80ebc9

Please sign in to comment.