diff options
Diffstat (limited to 'apps')
192 files changed, 480 insertions, 480 deletions
diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php index 81212ad98d3..25e117c7155 100644 --- a/apps/accessibility/lib/Controller/AccessibilityController.php +++ b/apps/accessibility/lib/Controller/AccessibilityController.php @@ -247,7 +247,7 @@ class AccessibilityController extends Controller { * * @return array */ - private function getUserValues(): array{ + private function getUserValues(): array { $userTheme = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false); $userFont = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false); $userHighContrast = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'highcontrast', false); diff --git a/apps/accessibility/lib/Controller/ConfigController.php b/apps/accessibility/lib/Controller/ConfigController.php index dd070d291b8..726cca31076 100644 --- a/apps/accessibility/lib/Controller/ConfigController.php +++ b/apps/accessibility/lib/Controller/ConfigController.php @@ -116,7 +116,7 @@ class ConfigController extends OCSController { $highcontrast = [$this->accessibilityProvider->getHighContrast()]; $fonts = $this->accessibilityProvider->getFonts(); - $availableOptions = array_map(function($option) { + $availableOptions = array_map(function ($option) { return $option['id']; }, array_merge($themes, $highcontrast, $fonts)); diff --git a/apps/accessibility/lib/Migration/RepairUserConfig.php b/apps/accessibility/lib/Migration/RepairUserConfig.php index d5940f76509..a479afaf052 100644 --- a/apps/accessibility/lib/Migration/RepairUserConfig.php +++ b/apps/accessibility/lib/Migration/RepairUserConfig.php @@ -73,7 +73,7 @@ class RepairUserConfig implements IRepairStep { */ public function run(IOutput $output) { $output->startProgress(); - $this->userManager->callForSeenUsers(function(IUser $user) use ($output) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($output) { $theme = $this->config->getUserValue($user->getUID(), Application::APP_NAME, 'theme', false); if ($theme === 'themedark') { $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'theme', 'dark'); diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 46dbf35cfc2..7e6c5410f6e 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -120,7 +120,7 @@ class Application extends App { $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); } - protected function groupHooks() { + protected function groupHooks() { $groupActions = new GroupManagement($this->logger); /** @var IGroupManager|Manager $groupManager */ @@ -154,15 +154,15 @@ class Application extends App { protected function appHooks() { $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function(ManagerEvent $event) { + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) { $appActions = new AppManagement($this->logger); $appActions->enableApp($event->getAppID()); }); - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function(ManagerEvent $event) { + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function (ManagerEvent $event) { $appActions = new AppManagement($this->logger); $appActions->enableAppForGroups($event->getAppID(), $event->getGroups()); }); - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function(ManagerEvent $event) { + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function (ManagerEvent $event) { $appActions = new AppManagement($this->logger); $appActions->disableApp($event->getAppID()); }); @@ -171,7 +171,7 @@ class Application extends App { protected function consoleHooks() { $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); - $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function(ConsoleEvent $event) { + $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function (ConsoleEvent $event) { $appActions = new Console($this->logger); $appActions->runCommand($event->getArguments()); }); @@ -182,7 +182,7 @@ class Application extends App { $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); $eventDispatcher->addListener( IPreview::EVENT, - function(GenericEvent $event) use ($fileActions) { + function (GenericEvent $event) use ($fileActions) { /** @var File $file */ $file = $event->getSubject(); $fileActions->preview([ @@ -253,11 +253,11 @@ class Application extends App { protected function securityHooks() { $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); - $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function(GenericEvent $event) { + $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function (GenericEvent $event) { $security = new Security($this->logger); $security->twofactorSuccess($event->getSubject(), $event->getArguments()); }); - $eventDispatcher->addListener(IProvider::EVENT_FAILED, function(GenericEvent $event) { + $eventDispatcher->addListener(IProvider::EVENT_FAILED, function (GenericEvent $event) { $security = new Security($this->logger); $security->twofactorFailed($event->getSubject(), $event->getArguments()); }); diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php index 811f91475ec..a4c01f3f620 100644 --- a/apps/comments/lib/AppInfo/Application.php +++ b/apps/comments/lib/AppInfo/Application.php @@ -45,7 +45,7 @@ class Application extends App { const APP_ID = 'comments'; - public function __construct (array $urlParams = []) { + public function __construct(array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); $container = $this->getContainer(); @@ -77,8 +77,8 @@ class Application extends App { } protected function registerDavEntity(IEventDispatcher $dispatcher) { - $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { - $event->addEntityCollection('files', function($name) { + $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) { + $event->addEntityCollection('files', function ($name) { $nodes = \OC::$server->getUserFolder()->getById((int)$name); return !empty($nodes); }); diff --git a/apps/comments/lib/Collaboration/CommentersSorter.php b/apps/comments/lib/Collaboration/CommentersSorter.php index d0bd8f20305..0db043f918b 100644 --- a/apps/comments/lib/Collaboration/CommentersSorter.php +++ b/apps/comments/lib/Collaboration/CommentersSorter.php @@ -60,7 +60,7 @@ class CommentersSorter implements ISorter { // at least on PHP 5.6 usort turned out to be not stable. So we add // the current index to the value and compare it on a draw $i = 0; - $workArray = array_map(function($element) use (&$i) { + $workArray = array_map(function ($element) use (&$i) { return [$i++, $element]; }, $byType); diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index 4127877f5aa..ff5a324946b 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -39,14 +39,14 @@ use Symfony\Component\EventDispatcher\GenericEvent; $app = \OC::$server->query(Application::class); $app->registerHooks(); -\OC::$server->registerService('CardDAVSyncService', function() use ($app) { +\OC::$server->registerService('CardDAVSyncService', function () use ($app) { return $app->getSyncService(); }); $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', - function(GenericEvent $event) use ($app) { + function (GenericEvent $event) use ($app) { /** @var CardDavBackend $cardDavBackend */ $cardDavBackend = $app->getContainer()->query(CardDavBackend::class); $addressBookUri = $event->getSubject(); @@ -58,7 +58,7 @@ $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', ); $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', - function(GenericEvent $event) use ($app) { + function (GenericEvent $event) use ($app) { $jobList = $app->getContainer()->getServer()->getJobList(); $subscriptionData = $event->getArgument('subscriptionData'); @@ -77,7 +77,7 @@ $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription ); $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', - function(GenericEvent $event) use ($app) { + function (GenericEvent $event) use ($app) { $jobList = $app->getContainer()->getServer()->getJobList(); $subscriptionData = $event->getArgument('subscriptionData'); @@ -92,7 +92,7 @@ $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription } ); -$eventHandler = function() use ($app) { +$eventHandler = function () use ($app) { try { $job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class); $job->run([]); @@ -106,7 +106,7 @@ $eventDispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $event $eventDispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler); $cm = \OC::$server->getContactsManager(); -$cm->register(function() use ($cm, $app) { +$cm->register(function () use ($cm, $app) { $user = \OC::$server->getUserSession()->getUser(); if (!is_null($user)) { $app->setupContactsProvider($cm, $user->getUID()); @@ -116,7 +116,7 @@ $cm->register(function() use ($cm, $app) { }); $calendarManager = \OC::$server->getCalendarManager(); -$calendarManager->register(function() use ($calendarManager, $app) { +$calendarManager->register(function () use ($calendarManager, $app) { $user = \OC::$server->getUserSession()->getUser(); if ($user !== null) { $app->setupCalendarProvider($calendarManager, $user->getUID()); diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php index e270a6b7d9b..6a6a60b3f09 100644 --- a/apps/dav/appinfo/v1/webdav.php +++ b/apps/dav/appinfo/v1/webdav.php @@ -68,7 +68,7 @@ $authPlugin->addBackend($bearerAuthPlugin); $requestUri = \OC::$server->getRequest()->getRequestUri(); -$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function() { +$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function () { // use the view for the logged in user return \OC\Files\Filesystem::getView(); }); diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 7cee070c6d1..64a1f738a70 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -65,7 +65,7 @@ class Application extends App { $container = $this->getContainer(); $server = $container->getServer(); - $container->registerService(PhotoCache::class, function(SimpleContainer $s) use ($server) { + $container->registerService(PhotoCache::class, function (SimpleContainer $s) use ($server) { return new PhotoCache( $server->getAppDataDir('dav-photocache'), $server->getLogger() @@ -147,7 +147,7 @@ class Application extends App { } }); - $clearPhotoCache = function($event) { + $clearPhotoCache = function ($event) { if ($event instanceof GenericEvent) { /** @var PhotoCache $p */ $p = $this->getContainer()->query(PhotoCache::class); @@ -160,20 +160,20 @@ class Application extends App { $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache); $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache); - $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) { + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) { $user = $event->getSubject(); $syncService = $this->getContainer()->query(SyncService::class); $syncService->updateUser($user); }); - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) { + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); $backend->onCalendarAdd( $event->getArgument('calendarData') ); }); - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) { + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); $backend->onCalendarUpdate( @@ -182,7 +182,7 @@ class Application extends App { $event->getArgument('propertyMutations') ); }); - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function(GenericEvent $event) { + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function (GenericEvent $event) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); $backend->onCalendarDelete( @@ -195,7 +195,7 @@ class Application extends App { $event->getArgument('calendarId') ); }); - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) { + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); $backend->onCalendarUpdateShares( @@ -208,7 +208,7 @@ class Application extends App { // Here we should recalculate if reminders should be sent to new or old sharees }); - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) { + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); $backend->onCalendarPublication( @@ -217,7 +217,7 @@ class Application extends App { ); }); - $listener = function(GenericEvent $event, $eventName) { + $listener = function (GenericEvent $event, $eventName) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); diff --git a/apps/dav/lib/AppInfo/PluginManager.php b/apps/dav/lib/AppInfo/PluginManager.php index db54e057498..21ff40ba6b8 100644 --- a/apps/dav/lib/AppInfo/PluginManager.php +++ b/apps/dav/lib/AppInfo/PluginManager.php @@ -272,7 +272,7 @@ class PluginManager { * @param string[] $plugin */ private function loadSabreAddressBookPluginsFromInfoXml(array $plugins): void { - $providers = array_map(function(string $className): IAddressBookProvider { + $providers = array_map(function (string $className): IAddressBookProvider { $instance = $this->createPluginInstance($className); if (!($instance instanceof IAddressBookProvider)) { throw new \Exception("Sabre address book plugin class '$className' does not implement the \OCA\DAV\CardDAV\Integration\IAddressBookProvider interface"); diff --git a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php index 93d3091042f..8396bfb9a5a 100644 --- a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php +++ b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php @@ -57,7 +57,7 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob { * @inheritDoc */ public function run($argument) { - $this->userManager->callForSeenUsers(function(IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user) { $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ 'userId' => $user->getUID(), 'purgeBeforeGenerating' => true diff --git a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php index 75a36823620..7fe107e0004 100644 --- a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php @@ -398,7 +398,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { ->where($query->expr()->eq('backend_id', $query->createNamedParameter($backendId))); $stmt = $query->execute(); - return array_map(function($row) { + return array_map(function ($row) { return $row['resource_id']; }, $stmt->fetchAll(\PDO::FETCH_NAMED)); } diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index cd88ed4ab1e..f5863ddeafe 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -77,7 +77,7 @@ class UploadCleanup extends TimedJob { // The folder has to be more than a day old $initial = $uploadFolder->getMTime() < $time; - $expire = array_reduce($files, function(bool $carry, File $file) use ($time) { + $expire = array_reduce($files, function (bool $carry, File $file) use ($time) { return $carry && $file->getMTime() < $time; }, $initial); diff --git a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php index 0e6436a7b09..a1ebd409f0e 100644 --- a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php +++ b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php @@ -87,7 +87,7 @@ class EnablePlugin extends ServerPlugin { * * @return string */ - public function getPluginName() { + public function getPluginName() { return 'nc-enable-birthday-calendar'; } diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index cf06cb5ab25..f947ea9d01e 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -308,7 +308,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); - $principals = array_map(function($principal) { + $principals = array_map(function ($principal) { return urldecode($principal); }, $principals); $principals[]= $principalUri; @@ -800,7 +800,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription /** * @suppress SqlInjectionChecker */ - $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { + $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { $newValues = []; foreach ($mutations as $propertyName => $propertyValue) { @@ -1587,7 +1587,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $outerQuery->execute(); $calendarObjects = $result->fetchAll(); - return array_map(function($o) { + return array_map(function ($o) { $calendarData = Reader::read($o['calendardata']); $comps = $calendarData->getComponents(); $objects = []; @@ -1605,10 +1605,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'type' => $o['componenttype'], 'uid' => $o['uid'], 'uri' => $o['uri'], - 'objects' => array_map(function($c) { + 'objects' => array_map(function ($c) { return $this->transformSearchData($c); }, $objects), - 'timezones' => array_map(function($c) { + 'timezones' => array_map(function ($c) { return $this->transformSearchData($c); }, $timezones), ]; @@ -1624,7 +1624,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription /** @var Component[] $subComponents */ $subComponents = $comp->getComponents(); /** @var Property[] $properties */ - $properties = array_filter($comp->children(), function($c) { + $properties = array_filter($comp->children(), function ($c) { return $c instanceof Property; }); $validationRules = $comp->getValidationRules(); @@ -1993,7 +1993,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription /** * @suppress SqlInjectionChecker */ - $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { + $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { $newValues = []; diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 38598e30ce3..1c7e0106fb6 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -225,7 +225,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { parent::getOwner(), 'principals/system/public' ]; - return array_filter($acl, function($rule) use ($allowedPrincipals) { + return array_filter($acl, function ($rule) use ($allowedPrincipals) { return \in_array($rule['principal'], $allowedPrincipals, true); }); } @@ -246,7 +246,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri']) { $principal = 'principal:' . parent::getOwner(); $shares = $this->caldavBackend->getShares($this->getResourceId()); - $shares = array_filter($shares, function($share) use ($principal){ + $shares = array_filter($shares, function ($share) use ($principal) { return $share['href'] === $principal; }); if (empty($shares)) { diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 28e96e9b1d5..59b97312062 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -95,7 +95,7 @@ class PublishPlugin extends ServerPlugin { * * @return string */ - public function getPluginName() { + public function getPluginName() { return 'oc-calendar-publishing'; } @@ -128,7 +128,7 @@ class PublishPlugin extends ServerPlugin { } }); - $propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function() use ($node) { + $propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function () use ($node) { $canShare = (!$node->isSubscription() && $node->canWrite()); $canPublish = (!$node->isSubscription() && $node->canWrite()); diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index fe4153fccf0..39fe4b248cb 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -727,7 +727,7 @@ class ReminderService { * @return VObject\Component\VEvent[] */ private function getRecurrenceExceptionFromListOfVEvents(array $vevents):array { - return array_values(array_filter($vevents, function(VEvent $vevent) { + return array_values(array_filter($vevents, function (VEvent $vevent) { return $vevent->{'RECURRENCE-ID'} !== null; })); } @@ -737,7 +737,7 @@ class ReminderService { * @return VEvent|null */ private function getMasterItemFromListOfVEvents(array $vevents):?VEvent { - $elements = array_values(array_filter($vevents, function(VEvent $vevent) { + $elements = array_values(array_filter($vevents, function (VEvent $vevent) { return $vevent->{'RECURRENCE-ID'} === null; })); diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 5a25fbaa22e..96b4371bd7c 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -305,11 +305,11 @@ abstract class AbstractPrincipalBackend implements BackendInterface { default: $rowsByMetadata = $this->searchPrincipalsByMetadataKey($prop, $value); - $filteredRows = array_filter($rowsByMetadata, function($row) use ($usersGroups) { + $filteredRows = array_filter($rowsByMetadata, function ($row) use ($usersGroups) { return $this->isAllowedToAccessResource($row, $usersGroups); }); - $results[] = array_map(function($row) { + $results[] = array_map(function ($row) { return $row['uri']; }, $filteredRows); diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php index 55a7b3ee691..7ad4a3904ed 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -261,7 +261,7 @@ EOF; */ function propFindDefaultCalendarUrl(PropFind $propFind, INode $node) { if ($node instanceof IPrincipal) { - $propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function() use ($node) { + $propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function () use ($node) { /** @var \OCA\DAV\CalDAV\Plugin $caldavPlugin */ $caldavPlugin = $this->server->getPlugin('caldav'); $principalUrl = $node->getPrincipalUrl(); diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index d25018c1298..d00e0886b61 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -166,7 +166,7 @@ class RefreshWebcalService { public function getSubscription(string $principalUri, string $uri) { $subscriptions = array_values(array_filter( $this->calDavBackend->getSubscriptionsForUser($principalUri), - function($sub) use ($uri) { + function ($sub) use ($uri) { return $sub['uri'] === $uri; } )); @@ -197,7 +197,7 @@ class RefreshWebcalService { ->withHeader('Accept', 'text/calendar, application/calendar+json, application/calendar+xml') ->withHeader('User-Agent', 'Nextcloud Webcal Crawler'); })); - $handlerStack->push(Middleware::mapResponse(function(ResponseInterface $response) use (&$didBreak301Chain, &$latestLocation) { + $handlerStack->push(Middleware::mapResponse(function (ResponseInterface $response) use (&$didBreak301Chain, &$latestLocation) { if (!$didBreak301Chain) { if ($response->getStatusCode() !== 301) { $didBreak301Chain = true; diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 4fc97ac401f..010e98d18e7 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -145,7 +145,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { $acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system']; - return array_filter($acl, function($rule) use ($allowedPrincipals) { + return array_filter($acl, function ($rule) use ($allowedPrincipals) { return \in_array($rule['principal'], $allowedPrincipals, true); }); } @@ -183,7 +183,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { $principal = 'principal:' . parent::getOwner(); $shares = $this->carddavBackend->getShares($this->getResourceId()); - $shares = array_filter($shares, function($share) use ($principal){ + $shares = array_filter($shares, function ($share) use ($principal) { return $share['href'] === $principal; }); if (empty($shares)) { diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index ee9f723be6b..1f44b63a575 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -174,7 +174,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); - $principals = array_map(function($principal) { + $principals = array_map(function ($principal) { return urldecode($principal); }, $principals); $principals[]= $principalUri; @@ -363,7 +363,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { /** * @suppress SqlInjectionChecker */ - $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { + $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { $updates = []; foreach($mutations as $property=>$newValue) { @@ -939,7 +939,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $result->closeCursor(); - return array_map(function($array) { + return array_map(function ($array) { $array['carddata'] = $this->readBlob($array['carddata']); return $array; }, $cards); diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index d163565a7a2..c0241de2076 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -322,7 +322,7 @@ class SyncService { public function syncInstance(\Closure $progressCallback = null) { $systemAddressBook = $this->getLocalSystemAddressBook(); - $this->userManager->callForSeenUsers(function($user) use ($systemAddressBook, $progressCallback) { + $this->userManager->callForSeenUsers(function ($user) use ($systemAddressBook, $progressCallback) { $this->updateUser($user); if (!is_null($progressCallback)) { $progressCallback(); diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index 4b4ec4e12e9..7ebe3b03d11 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -72,7 +72,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { $addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri); /** @var IAddressBook[] $objects */ - $objects = array_map(function(array $addressBook) { + $objects = array_map(function (array $addressBook) { if ($addressBook['principaluri'] === 'principals/system/system') { return new SystemAddressbook($this->carddavBackend, $addressBook, $this->l10n, $this->config); } @@ -80,7 +80,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { return new AddressBook($this->carddavBackend, $addressBook, $this->l10n); }, $addressBooks); /** @var IAddressBook[][] $objectsFromPlugins */ - $objectsFromPlugins = array_map(function(IAddressBookProvider $plugin): array { + $objectsFromPlugins = array_map(function (IAddressBookProvider $plugin): array { return $plugin->fetchAllForAddressBookHome($this->principalUri); }, $this->pluginManager->getAddressBookPlugins()); diff --git a/apps/dav/lib/Command/SyncBirthdayCalendar.php b/apps/dav/lib/Command/SyncBirthdayCalendar.php index f11c5784d55..211df745e41 100644 --- a/apps/dav/lib/Command/SyncBirthdayCalendar.php +++ b/apps/dav/lib/Command/SyncBirthdayCalendar.php @@ -96,7 +96,7 @@ class SyncBirthdayCalendar extends Command { $output->writeln("Start birthday calendar sync for all users ..."); $p = new ProgressBar($output); $p->start(); - $this->userManager->callForSeenUsers(function($user) use ($p) { + $this->userManager->callForSeenUsers(function ($user) use ($p) { $p->advance(); $userId = $user->getUID(); @@ -113,7 +113,7 @@ class SyncBirthdayCalendar extends Command { $output->writeln(''); } - protected function verifyEnabled () { + protected function verifyEnabled() { $isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'); if ($isEnabled !== 'yes') { diff --git a/apps/dav/lib/Command/SyncSystemAddressBook.php b/apps/dav/lib/Command/SyncSystemAddressBook.php index 1729ab8f382..f707e733add 100644 --- a/apps/dav/lib/Command/SyncSystemAddressBook.php +++ b/apps/dav/lib/Command/SyncSystemAddressBook.php @@ -56,7 +56,7 @@ class SyncSystemAddressBook extends Command { $output->writeln('Syncing users ...'); $progress = new ProgressBar($output); $progress->start(); - $this->syncService->syncInstance(function() use ($progress) { + $this->syncService->syncInstance(function () use ($progress) { $progress->advance(); }); diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index a8e4c2885b4..d54f81b7a8e 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -85,7 +85,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { $this->logger = $logger; $methods = get_class_methods($this->comment); - $methods = array_filter($methods, function($name){ + $methods = array_filter($methods, function ($name) { return strpos($name, 'get') === 0; }); foreach($methods as $getter) { @@ -283,7 +283,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * @return array */ protected function composeMentionsPropertyValue() { - return array_map(function($mention) { + return array_map(function ($mention) { try { $displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']); } catch (\OutOfBoundsException $e) { diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 5fc8666de05..55b0bdd4b40 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -91,7 +91,7 @@ class CommentsPlugin extends ServerPlugin { $this->server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; - $this->server->xml->classMap['DateTime'] = function(Writer $writer, \DateTime $value) { + $this->server->xml->classMap['DateTime'] = function (Writer $writer, \DateTime $value) { $writer->write(\Sabre\HTTP\toDate($value)); }; diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index a479d0ff965..51d453e3f2a 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -99,15 +99,15 @@ class CommentPropertiesPlugin extends ServerPlugin { } } - $propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node) { + $propFind->handle(self::PROPERTY_NAME_COUNT, function () use ($node) { return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId()); }); - $propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node) { + $propFind->handle(self::PROPERTY_NAME_HREF, function () use ($node) { return $this->getCommentsLink($node); }); - $propFind->handle(self::PROPERTY_NAME_UNREAD, function() use ($node) { + $propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node) { if (isset($this->cachedUnreadCount[$node->getId()])) { return $this->cachedUnreadCount[$node->getId()]; } else { diff --git a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php index 7f1a735c7a4..62c9915cc4e 100644 --- a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php @@ -89,10 +89,10 @@ class FakeLockerPlugin extends ServerPlugin { * @return void */ function propFind(PropFind $propFind, INode $node) { - $propFind->handle('{DAV:}supportedlock', function() { + $propFind->handle('{DAV:}supportedlock', function () { return new SupportedLock(true); }); - $propFind->handle('{DAV:}lockdiscovery', function() use ($propFind) { + $propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) { return new LockDiscovery([]); }); } diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 8f94ea9a52e..890e65a7fa5 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -180,7 +180,7 @@ class FilesPlugin extends ServerPlugin { $this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']); $this->server->on('afterMethod:GET', [$this,'httpGet']); $this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']); - $this->server->on('afterResponse', function($request, ResponseInterface $response) { + $this->server->on('afterResponse', function ($request, ResponseInterface $response) { $body = $response->getBody(); if (is_resource($body)) { fclose($body); @@ -305,15 +305,15 @@ class FilesPlugin extends ServerPlugin { * } */ - $propFind->handle(self::FILEID_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::FILEID_PROPERTYNAME, function () use ($node) { return $node->getFileId(); }); - $propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { return $node->getInternalFileId(); }); - $propFind->handle(self::PERMISSIONS_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use ($node) { $perms = $node->getDavPermissions(); if ($this->isPublic) { // remove mount information @@ -322,13 +322,13 @@ class FilesPlugin extends ServerPlugin { return $perms; }); - $propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) { + $propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) { return $node->getSharePermissions( $httpRequest->getRawServerValue('PHP_AUTH_USER') ); }); - $propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) { + $propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) { $ncPermissions = $node->getSharePermissions( $httpRequest->getRawServerValue('PHP_AUTH_USER') ); @@ -336,11 +336,11 @@ class FilesPlugin extends ServerPlugin { return json_encode($ocmPermissions); }); - $propFind->handle(self::GETETAG_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node) { return $node->getETag(); }); - $propFind->handle(self::OWNER_ID_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use ($node) { $owner = $node->getOwner(); if (!$owner) { return null; @@ -348,7 +348,7 @@ class FilesPlugin extends ServerPlugin { return $owner->getUID(); } }); - $propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use ($node) { $owner = $node->getOwner(); if (!$owner) { return null; @@ -360,14 +360,14 @@ class FilesPlugin extends ServerPlugin { $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { return json_encode($this->previewManager->isAvailable($node->getFileInfo())); }); - $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) { return $node->getSize(); }); $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->getMountPoint()->getMountType(); }); - $propFind->handle(self::SHARE_NOTE, function() use ($node, $httpRequest) { + $propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest) { return $node->getNoteFromShare( $httpRequest->getRawServerValue('PHP_AUTH_USER') ); @@ -375,13 +375,13 @@ class FilesPlugin extends ServerPlugin { } if ($node instanceof \OCA\DAV\Connector\Sabre\Node) { - $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () use ($node) { return $this->config->getSystemValue('data-fingerprint', ''); }); } if ($node instanceof \OCA\DAV\Connector\Sabre\File) { - $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use ($node) { /** @var $node \OCA\DAV\Connector\Sabre\File */ try { $directDownloadUrl = $node->getDirectDownload(); @@ -396,7 +396,7 @@ class FilesPlugin extends ServerPlugin { return false; }); - $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function () use ($node) { $checksum = $node->getChecksum(); if ($checksum === null || $checksum === '') { return null; @@ -405,22 +405,22 @@ class FilesPlugin extends ServerPlugin { return new ChecksumList($checksum); }); - $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->getCreationTime(); }); - $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->getUploadTime(); }); } if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) { - $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) { return $node->getSize(); }); - $propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->isEncrypted() ? '1' : '0'; }); } @@ -467,14 +467,14 @@ class FilesPlugin extends ServerPlugin { return; } - $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function($time) use ($node) { + $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function ($time) use ($node) { if (empty($time)) { return false; } $node->touch($time); return true; }); - $propPatch->handle(self::GETETAG_PROPERTYNAME, function($etag) use ($node) { + $propPatch->handle(self::GETETAG_PROPERTYNAME, function ($etag) use ($node) { if (empty($etag)) { return false; } @@ -483,7 +483,7 @@ class FilesPlugin extends ServerPlugin { } return false; }); - $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function($time) use ($node) { + $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function ($time) use ($node) { if (empty($time)) { return false; } diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 2fa01c0315d..73ebabdc48f 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -273,7 +273,7 @@ class Principal implements BackendInterface { $users = $this->userManager->getByEmail($value); if (!$allowEnumeration) { - $users = \array_filter($users, static function(IUser $user) use ($value) { + $users = \array_filter($users, static function (IUser $user) use ($value) { return $user->getEMailAddress() === $value; }); } @@ -287,7 +287,7 @@ class Principal implements BackendInterface { }); } - $results[] = array_reduce($users, function(array $carry, IUser $user) use ($restrictGroups) { + $results[] = array_reduce($users, function (array $carry, IUser $user) use ($restrictGroups) { // is sharing restricted to groups only? if ($restrictGroups !== false) { $userGroups = $this->groupManager->getUserGroupIds($user); @@ -305,7 +305,7 @@ class Principal implements BackendInterface { $users = $this->userManager->searchDisplayName($value); if (!$allowEnumeration) { - $users = \array_filter($users, static function(IUser $user) use ($value) { + $users = \array_filter($users, static function (IUser $user) use ($value) { return $user->getDisplayName() === $value; }); } @@ -319,7 +319,7 @@ class Principal implements BackendInterface { }); } - $results[] = array_reduce($users, function(array $carry, IUser $user) use ($restrictGroups) { + $results[] = array_reduce($users, function (array $carry, IUser $user) use ($restrictGroups) { // is sharing restricted to groups only? if ($restrictGroups !== false) { $userGroups = $this->groupManager->getUserGroupIds($user); @@ -518,7 +518,7 @@ class Principal implements BackendInterface { $circles = \OCA\Circles\Api\v1\Circles::joinedCircles($name, true); - $circles = array_map(function($circle) { + $circles = array_map(function ($circle) { /** @var \OCA\Circles\Model\Circle $circle */ return 'principals/circles/' . urlencode($circle->getUniqueId()); }, $circles); diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index 8b811226734..ef1e7236c9b 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -200,14 +200,14 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode) { $shares = $this->getShares($sabreNode); - $shareTypes = array_unique(array_map(function(IShare $share) { + $shareTypes = array_unique(array_map(function (IShare $share) { return $share->getShareType(); }, $shares)); return new ShareTypeList($shareTypes); }); - $propFind->handle(self::SHAREES_PROPERTYNAME, function() use ($sabreNode) { + $propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode) { $shares = $this->getShares($sabreNode); return new ShareeList($shares); diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index 9cefe682de9..83995a31e57 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -246,12 +246,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin $isFav = null; - $propFind->handle(self::TAGS_PROPERTYNAME, function() use (&$isFav, $node) { + $propFind->handle(self::TAGS_PROPERTYNAME, function () use (&$isFav, $node) { list($tags, $isFav) = $this->getTagsAndFav($node->getId()); return new TagList($tags); }); - $propFind->handle(self::FAVORITE_PROPERTYNAME, function() use ($isFav, $node) { + $propFind->handle(self::FAVORITE_PROPERTYNAME, function () use ($isFav, $node) { if (is_null($isFav)) { list(, $isFav) = $this->getTagsAndFav($node->getId()); } @@ -277,12 +277,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin return; } - $propPatch->handle(self::TAGS_PROPERTYNAME, function($tagList) use ($node) { + $propPatch->handle(self::TAGS_PROPERTYNAME, function ($tagList) use ($node) { $this->updateTags($node->getId(), $tagList->getTags()); return true; }); - $propPatch->handle(self::FAVORITE_PROPERTYNAME, function($favState) use ($node) { + $propPatch->handle(self::FAVORITE_PROPERTYNAME, function ($favState) use ($node) { if ((int)$favState === 1 || $favState === 'true') { $this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE); } else { diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php index 6eb014985d5..3be7b28c51b 100644 --- a/apps/dav/lib/Controller/BirthdayCalendarController.php +++ b/apps/dav/lib/Controller/BirthdayCalendarController.php @@ -78,7 +78,7 @@ class BirthdayCalendarController extends Controller { IDBConnection $db, IConfig $config, IJobList $jobList, IUserManager $userManager, - CalDavBackend $calDavBackend){ + CalDavBackend $calDavBackend) { parent::__construct($appName, $request); $this->db = $db; $this->config = $config; @@ -94,7 +94,7 @@ class BirthdayCalendarController extends Controller { $this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes'); // add background job for each user - $this->userManager->callForSeenUsers(function(IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user) { $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ 'userId' => $user->getUID(), ]); diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index b610420faae..04fe0223607 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -134,7 +134,7 @@ class GroupPrincipalBackend implements BackendInterface { return []; } - return array_map(function($user) { + return array_map(function ($user) { return $this->userToPrincipal($user); }, $group->getUsers()); } @@ -210,7 +210,7 @@ class GroupPrincipalBackend implements BackendInterface { case '{DAV:}displayname': $groups = $this->groupManager->search($value); - $results[] = array_reduce($groups, function(array $carry, IGroup $group) use ($restrictGroups) { + $results[] = array_reduce($groups, function (array $carry, IGroup $group) use ($restrictGroups) { $gid = $group->getGID(); // is sharing restricted to groups only? if ($restrictGroups !== false) { diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index 2723dcf8bf7..fec26f145ad 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -192,7 +192,7 @@ class Plugin extends ServerPlugin { function propFind(PropFind $propFind, INode $node) { if ($node instanceof IShareable) { - $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function() use ($node) { + $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) { return new Invite( $node->getShares() ); diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 57c81ba15f6..6dbdeaa6fd9 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -66,7 +66,7 @@ class FilesDropPlugin extends ServerPlugin { $this->enabled = false; } - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { if (!$this->enabled) { return; diff --git a/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php b/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php index eaa3d78b66d..60e11884765 100644 --- a/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php +++ b/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php @@ -56,7 +56,7 @@ class PublicLinkCheckPlugin extends ServerPlugin { $server->on('beforeMethod:*', [$this, 'beforeMethod']); } - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { // verify that the owner didn't have his share permissions revoked if ($this->fileInfo && !$this->fileInfo->isShareable()) { throw new NotFound(); diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index 99f45640560..e4feaf5d42f 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -156,7 +156,7 @@ class AppleProvisioningPlugin extends ServerPlugin { $filename = $userId . '-' . AppleProvisioningNode::FILENAME; $xmlSkeleton = $this->getTemplate(); - $body = vsprintf($xmlSkeleton, array_map(function($v) { + $body = vsprintf($xmlSkeleton, array_map(function ($v) { return \htmlspecialchars($v, ENT_XML1, 'UTF-8'); }, [ $description, diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 230e72fd277..1a432008a3a 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -295,7 +295,7 @@ class Server { \OC::$server->getThemingDefaults(), \OC::$server->getRequest(), \OC::$server->getL10N('dav'), - function() { + function () { return UUIDUtil::getUUID(); } )); diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 6d1668acf06..4ca7b041884 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -226,29 +226,29 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { return; } - $propFind->handle(self::ID_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::ID_PROPERTYNAME, function () use ($node) { return $node->getSystemTag()->getId(); }); - $propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) { return $node->getSystemTag()->getName(); }); - $propFind->handle(self::USERVISIBLE_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::USERVISIBLE_PROPERTYNAME, function () use ($node) { return $node->getSystemTag()->isUserVisible() ? 'true' : 'false'; }); - $propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function () use ($node) { // this is the tag's inherent property "is user assignable" return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false'; }); - $propFind->handle(self::CANASSIGN_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::CANASSIGN_PROPERTYNAME, function () use ($node) { // this is the effective permission for the current user return $this->tagManager->canUserAssignTag($node->getSystemTag(), $this->userSession->getUser()) ? 'true' : 'false'; }); - $propFind->handle(self::GROUPS_PROPERTYNAME, function() use ($node) { + $propFind->handle(self::GROUPS_PROPERTYNAME, function () use ($node) { if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) { // property only available for admins throw new Forbidden(); @@ -281,7 +281,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { self::USERVISIBLE_PROPERTYNAME, self::USERASSIGNABLE_PROPERTYNAME, self::GROUPS_PROPERTYNAME, - ], function($props) use ($node) { + ], function ($props) use ($node) { $tag = $node->getSystemTag(); $name = $tag->getName(); $userVisible = $tag->isUserVisible(); diff --git a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php index c033b1ce139..e44150aaabe 100644 --- a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php @@ -122,7 +122,7 @@ class SystemTagsByIdCollection implements ICollection { } $tags = $this->tagManager->getAllTags($visibilityFilter); - return array_map(function($tag) { + return array_map(function ($tag) { return $this->makeNode($tag); }, $tags); } diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php index 88c6f5a4648..712a18d5dbc 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php @@ -138,11 +138,11 @@ class SystemTagsObjectMappingCollection implements ICollection { $tags = $this->tagManager->getTagsByIds($tagIds); // filter out non-visible tags - $tags = array_filter($tags, function($tag) { + $tags = array_filter($tags, function ($tag) { return $this->tagManager->canUserSeeTag($tag, $this->user); }); - return array_values(array_map(function($tag) { + return array_values(array_map(function ($tag) { return $this->makeNode($tag); }, $tags)); } diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index 45fc3c14291..e85480d4a2f 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -60,7 +60,7 @@ class SystemTagsRelationsCollection extends SimpleCollection { $tagMapper, $userSession, $groupManager, - function($name) { + function ($name) { $nodes = \OC::$server->getUserFolder()->getById((int)$name); return !empty($nodes); } diff --git a/apps/dav/lib/Traits/PrincipalProxyTrait.php b/apps/dav/lib/Traits/PrincipalProxyTrait.php index d8f06a69f8e..ee8ac58e3c6 100644 --- a/apps/dav/lib/Traits/PrincipalProxyTrait.php +++ b/apps/dav/lib/Traits/PrincipalProxyTrait.php @@ -150,7 +150,7 @@ trait PrincipalProxyTrait { $proxy->setPermissions($proxy->getPermissions() | $permission); $this->proxyMapper->update($proxy); - $proxies = array_filter($proxies, function(Proxy $p) use ($proxy) { + $proxies = array_filter($proxies, function (Proxy $p) use ($proxy) { return $p->getId() !== $proxy->getId(); }); break; diff --git a/apps/dav/lib/Upload/FutureFile.php b/apps/dav/lib/Upload/FutureFile.php index 923376c8eab..34a5981bda2 100644 --- a/apps/dav/lib/Upload/FutureFile.php +++ b/apps/dav/lib/Upload/FutureFile.php @@ -86,7 +86,7 @@ class FutureFile implements \Sabre\DAV\IFile { */ function getSize() { $children = $this->root->getChildren(); - $sizes = array_map(function($node) { + $sizes = array_map(function ($node) { /** @var IFile $node */ return $node->getSize(); }, $children); diff --git a/apps/dav/lib/Upload/UploadHome.php b/apps/dav/lib/Upload/UploadHome.php index 77a5043b3a4..8bc96d8cf1f 100644 --- a/apps/dav/lib/Upload/UploadHome.php +++ b/apps/dav/lib/Upload/UploadHome.php @@ -59,7 +59,7 @@ class UploadHome implements ICollection { } public function getChildren(): array { - return array_map(function($node) { + return array_map(function ($node) { return new UploadFolder($node, $this->cleanupService); }, $this->impl()->getChildren()); } diff --git a/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php index e4db329393a..b7d907e5ce5 100644 --- a/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php +++ b/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php @@ -66,7 +66,7 @@ class RegisterRegenerateBirthdayCalendarsTest extends TestCase { public function testRun() { $this->userManager->expects($this->once()) ->method('callForSeenUsers') - ->willReturnCallback(function($closure) { + ->willReturnCallback(function ($closure) { $user1 = $this->createMock(IUser::class); $user1->method('getUID')->willReturn('uid1'); $user2 = $this->createMock(IUser::class); diff --git a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php index 002a3fd94b0..d260ed352e6 100644 --- a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php @@ -146,7 +146,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res6->method('getBackend')->willReturn($backend3); $res6->method('getAllAvailableMetadataKeys')->willReturn(['meta99', 'meta123']); - $res6->method('getMetadataForKey')->willReturnCallback(function($key) { + $res6->method('getMetadataForKey')->willReturnCallback(function ($key) { switch($key) { case 'meta99': return 'value99-new'; @@ -165,7 +165,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res7->method('getEMail')->willReturn('res7@foo.bar'); $res7->method('getBackend')->willReturn($backend3); $res7->method('getAllAvailableMetadataKeys')->willReturn(['meta1']); - $res7->method('getMetadataForKey')->willReturnCallback(function($key) { + $res7->method('getMetadataForKey')->willReturnCallback(function ($key) { switch($key) { case 'meta1': return 'value1'; @@ -181,7 +181,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res8->method('getEMail')->willReturn('res8@foo.bar'); $res8->method('getBackend')->willReturn($backend4); $res8->method('getAllAvailableMetadataKeys')->willReturn(['meta2']); - $res8->method('getMetadataForKey')->willReturnCallback(function($key) { + $res8->method('getMetadataForKey')->willReturnCallback(function ($key) { switch($key) { case 'meta2': return 'value2'; diff --git a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php index 9e09cda936c..f4179c60665 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php @@ -97,7 +97,7 @@ class BackendTest extends TestCase { $backend = $this->getBackend(['triggerCalendarActivity']); $backend->expects($this->once()) ->method('triggerCalendarActivity') - ->willReturnCallback(function() use($expectedPayload, $expectedSubject) { + ->willReturnCallback(function () use ($expectedPayload, $expectedSubject) { $arguments = func_get_args(); $this->assertSame($expectedSubject, array_shift($arguments)); $this->assertEquals($expectedPayload, $arguments); diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php index 018c0540be3..04ed3a47e05 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php @@ -45,7 +45,7 @@ class CalendarTest extends TestCase { $l = $this->createMock(IL10N::class); $l->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return vsprintf($string, $args); }); diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php index d013845345d..cc450283d9e 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php @@ -44,7 +44,7 @@ class TodoTest extends TestCase { $l = $this->createMock(IL10N::class); $l->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return vsprintf($string, $args); }); diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php index d2a9cd5e536..eb0ac34c15a 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php @@ -141,7 +141,7 @@ class BaseTest extends TestCase { $l = $this->createMock(IL10N::class); $l->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return 't(' . vsprintf($string, $args) . ')'; }); diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php index 345fd9cbe11..645eaa8b2f8 100644 --- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php +++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php @@ -129,7 +129,7 @@ class EnablePluginTest extends TestCase { $this->server->xml->expects($this->once()) ->method('parse') - ->willReturnCallback(function($requestBody, $url, &$documentType) { + ->willReturnCallback(function ($requestBody, $url, &$documentType) { $documentType = '{http://nextcloud.com/ns}disable-birthday-calendar'; }); @@ -167,7 +167,7 @@ class EnablePluginTest extends TestCase { $this->server->xml->expects($this->once()) ->method('parse') - ->willReturnCallback(function($requestBody, $url, &$documentType) { + ->willReturnCallback(function ($requestBody, $url, &$documentType) { $documentType = '{http://nextcloud.com/ns}enable-birthday-calendar'; }); diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 761ed734906..8cb6b9fbf10 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -401,7 +401,7 @@ EOD; $this->assertArrayHasKey('classification', $card); } - usort($calendarObjects, function($a, $b) { + usort($calendarObjects, function ($a, $b) { return $a['id'] - $b['id']; }); @@ -442,7 +442,7 @@ EOD; 'comp-filters' => $compFilter ]); - $expectedEventsInResult = array_map(function($index) use($events) { + $expectedEventsInResult = array_map(function ($index) use ($events) { return $events[$index]; }, $expectedEventsInResult); $this->assertEquals($expectedEventsInResult, $result, '', 0.0, 10, true); diff --git a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php index 94cb169648b..b4095990e50 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php @@ -70,7 +70,7 @@ class CalendarManagerTest extends \Test\TestCase { $calendarManager = $this->createMock(Manager::class); $calendarManager->expects($this->at(0)) ->method('registerCalendar') - ->willReturnCallback(function() { + ->willReturnCallback(function () { $parameter = func_get_arg(0); $this->assertInstanceOf(CalendarImpl::class, $parameter); $this->assertEquals(123, $parameter->getKey()); @@ -78,7 +78,7 @@ class CalendarManagerTest extends \Test\TestCase { $calendarManager->expects($this->at(1)) ->method('registerCalendar') - ->willReturnCallback(function() { + ->willReturnCallback(function () { $parameter = func_get_arg(0); $this->assertInstanceOf(CalendarImpl::class, $parameter); $this->assertEquals(456, $parameter->getKey()); diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 80ab0ff5af1..534661af6c6 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -569,7 +569,7 @@ EOD; $backend->expects($this->any()) ->method('getCalendarObject') - ->willReturnCallback(function($cId, $uri) use($publicObject, $confidentialObject) { + ->willReturnCallback(function ($cId, $uri) use ($publicObject, $confidentialObject) { switch($uri) { case 'event-0': return $publicObject; diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php index 9257fe56e63..69c34d76b09 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php @@ -80,7 +80,7 @@ class PushProviderTest extends AbstractNotificationProviderTest { ); } - public function testNotificationType():void { + public function testNotificationType():void { $this->assertEquals(PushProvider::NOTIFICATION_TYPE, 'DISPLAY'); } diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php index f0bd91bf002..2900e24119c 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php @@ -56,7 +56,7 @@ class NotificationProviderManagerTest extends TestCase { * @throws ProviderNotAvailableException * @throws NotificationTypeDoesNotExistException */ - public function testGetProviderForUnknownType(): void{ + public function testGetProviderForUnknownType(): void { $this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException::class); $this->expectExceptionMessage('Type NOT EXISTENT is not an accepted type of notification'); @@ -67,19 +67,19 @@ class NotificationProviderManagerTest extends TestCase { * @throws NotificationTypeDoesNotExistException * @throws ProviderNotAvailableException */ - public function testGetProviderForUnRegisteredType(): void{ + public function testGetProviderForUnRegisteredType(): void { $this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException::class); $this->expectExceptionMessage('No notification provider for type AUDIO available'); $this->providerManager->getProvider('AUDIO'); } - public function testGetProvider(): void{ + public function testGetProvider(): void { $provider = $this->providerManager->getProvider('EMAIL'); $this->assertInstanceOf(EmailProvider::class, $provider); } - public function testRegisterProvider(): void{ + public function testRegisterProvider(): void { $this->providerManager->registerProvider(PushProvider::class); $provider = $this->providerManager->getProvider('DISPLAY'); $this->assertInstanceOf(PushProvider::class, $provider); @@ -88,7 +88,7 @@ class NotificationProviderManagerTest extends TestCase { /** * @throws \OCP\AppFramework\QueryException */ - public function testRegisterBadProvider(): void{ + public function testRegisterBadProvider(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid notification provider registered'); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php index 38240182275..568a65b77d3 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php @@ -61,18 +61,18 @@ class NotifierTest extends TestCase { $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return vsprintf($string, $args); }); $this->l10n->expects($this->any()) ->method('l') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { /** \DateTime $args */ return $args->format(\DateTime::ATOM); }); $this->l10n->expects($this->any()) ->method('n') - ->willReturnCallback(function($textSingular, $textPlural, $count, $args) { + ->willReturnCallback(function ($textSingular, $textPlural, $count, $args) { $text = $count === 1 ? $textSingular : $textPlural; $text = str_replace('%n', (string)$count, $text); return vsprintf($text, $args); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index 11ecdbc354b..03e953f5c27 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -501,7 +501,7 @@ EOD; $provider1->expects($this->once()) ->method('send') - ->with($this->callback(function($vevent) { + ->with($this->callback(function ($vevent) { if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') { return false; } @@ -509,7 +509,7 @@ EOD; }, 'Displayname 123', $user)); $provider2->expects($this->once()) ->method('send') - ->with($this->callback(function($vevent) { + ->with($this->callback(function ($vevent) { if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') { return false; } @@ -517,7 +517,7 @@ EOD; }, 'Displayname 123', $user)); $provider3->expects($this->once()) ->method('send') - ->with($this->callback(function($vevent) { + ->with($this->callback(function ($vevent) { if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') { return false; } @@ -525,7 +525,7 @@ EOD; }, 'Displayname 123', $user)); $provider4->expects($this->once()) ->method('send') - ->with($this->callback(function($vevent) { + ->with($this->callback(function ($vevent) { if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-30T00:00:00+00:00') { return false; } @@ -533,7 +533,7 @@ EOD; }, 'Displayname 123', $user)); $provider5->expects($this->once()) ->method('send') - ->with($this->callback(function($vevent) { + ->with($this->callback(function ($vevent) { if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-07-07T00:00:00+00:00') { return false; } diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php index b2fdc7f0a81..1dbd45ea4ca 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php @@ -236,7 +236,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase { $this->proxyMapper->expects($this->at(1)) ->method('insert') - ->with($this->callback(function($proxy) { + ->with($this->callback(function ($proxy) { /** @var Proxy $proxy */ if ($proxy->getOwnerId() !== $this->principalPrefix . '/backend1-res1') { return false; @@ -252,7 +252,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase { })); $this->proxyMapper->expects($this->at(2)) ->method('insert') - ->with($this->callback(function($proxy) { + ->with($this->callback(function ($proxy) { /** @var Proxy $proxy */ if ($proxy->getOwnerId() !== $this->principalPrefix . '/backend1-res1') { return false; diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index ebe5beb7275..53e1b8d0c8f 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -107,7 +107,7 @@ class IMipPluginTest extends TestCase { $l10n = $this->createMock(IL10N::class); $l10n->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $l10nFactory = $this->createMock(IFactory::class); @@ -223,7 +223,7 @@ class IMipPluginTest extends TestCase { /** * @dataProvider dataIncludeResponseButtons */ - public function testIncludeResponseButtons(string $config_setting, string $recipient, bool $has_buttons ) { + public function testIncludeResponseButtons(string $config_setting, string $recipient, bool $has_buttons) { $message = $this->_testMessage([],$recipient); $this->_expectSend($recipient, true, $has_buttons); @@ -264,7 +264,7 @@ class IMipPluginTest extends TestCase { $this->assertEquals('1.1', $message->getScheduleStatus()); } - private function _testMessage(array $attrs = [], string $recipient = 'frodo@hobb.it' ) { + private function _testMessage(array $attrs = [], string $recipient = 'frodo@hobb.it') { $message = new Message(); $message->method = 'REQUEST'; $message->message = new VCalendar(); diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php index c5af8952b99..8de32ad8c35 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php @@ -116,7 +116,7 @@ class RefreshWebcalServiceTest extends TestCase { $client->expects($this->once()) ->method('get') - ->with('https://foo.bar/bla2', $this->callback(function($obj) { + ->with('https://foo.bar/bla2', $this->callback(function ($obj) { return $obj['allow_redirects']['redirects'] === 10 && $obj['handler'] instanceof HandlerStack; })) ->willReturn($response); diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index aa4f4e8443c..326e77a58be 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -280,7 +280,7 @@ class AddressBookImplTest extends TestCase { // simulate that 'uid0' already exists, so the second uid will be returned $this->backend->expects($this->exactly(2))->method('getContact') ->willReturnCallback( - function($id, $uid) { + function ($id, $uid) { return ($uid === 'uid0.vcf'); } ); diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php index e132f082556..e6ba0f5ef02 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -66,7 +66,7 @@ class BirthdayServiceTest extends TestCase { $this->l10n->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return vsprintf($string, $args); }); @@ -392,7 +392,7 @@ class BirthdayServiceTest extends TestCase { ]; } - public function providesCardChanges(){ + public function providesCardChanges() { return[ ['delete'], ['create'], diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 5efce1c23be..9d23280f607 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -258,7 +258,7 @@ class CardDavBackendTest extends TestCase { // Expect event $this->dispatcher->expects($this->at(0)) ->method('dispatch') - ->with('\OCA\DAV\CardDAV\CardDavBackend::createCard', $this->callback(function(GenericEvent $e) use ($bookId, $uri) { + ->with('\OCA\DAV\CardDAV\CardDavBackend::createCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) { return $e->getArgument('addressBookId') === $bookId && $e->getArgument('cardUri') === $uri && $e->getArgument('cardData') === $this->vcardTest0; @@ -285,7 +285,7 @@ class CardDavBackendTest extends TestCase { // Expect event $this->dispatcher->expects($this->at(0)) ->method('dispatch') - ->with('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $this->callback(function(GenericEvent $e) use ($bookId, $uri) { + ->with('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) { return $e->getArgument('addressBookId') === $bookId && $e->getArgument('cardUri') === $uri && $e->getArgument('cardData') === $this->vcardTest0; @@ -299,7 +299,7 @@ class CardDavBackendTest extends TestCase { // Expect event $this->dispatcher->expects($this->at(0)) ->method('dispatch') - ->with('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $this->callback(function(GenericEvent $e) use ($bookId, $uri) { + ->with('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) { return $e->getArgument('addressBookId') === $bookId && $e->getArgument('cardUri') === $uri; })); diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index 0f16259d337..4ef1f1bdda1 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -140,7 +140,7 @@ class ImageExportPluginTest extends TestCase { ->willReturn(1); $this->tree->method('getNodeForPath') - ->willReturnCallback(function($path) use ($card, $book) { + ->willReturnCallback(function ($path) use ($card, $book) { if ($path === 'user/book/card') { return $card; } else if ($path === 'user/book') { diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php index 5191c735a67..f039c0d6ea3 100644 --- a/apps/dav/tests/unit/Comments/RootCollectionTest.php +++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php @@ -100,8 +100,8 @@ class RootCollectionTest extends \Test\TestCase { ->method('getUser') ->willReturn($this->user); - $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { - $event->addEntityCollection('files', function() { + $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) { + $event->addEntityCollection('files', function () { return true; }); }); diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php index 95bab8cad5b..ff9fac3ff18 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php @@ -62,7 +62,7 @@ class ExceptionLoggerPluginTest extends TestCase { $config = $this->createMock(SystemConfig::class); $config->expects($this->any()) ->method('getValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { switch ($key) { case 'loglevel': return 0; diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 870f3709a58..bc49fb442a2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -283,7 +283,7 @@ class ObjectTreeTest extends \Test\TestCase { ->getMock(); $view->expects($this->once()) ->method('resolvePath') - ->willReturnCallback(function($path) use ($storage){ + ->willReturnCallback(function ($path) use ($storage) { return [$storage, ltrim($path, '/')]; }); diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index cb4104044b7..93cae17d539 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -392,7 +392,7 @@ class PrincipalTest extends TestCase { $this->proxyMapper->expects($this->at(1)) ->method('insert') - ->with($this->callback(function($proxy) { + ->with($this->callback(function ($proxy) { /** @var Proxy $proxy */ if ($proxy->getOwnerId() !== 'principals/users/foo') { return false; diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index e7a1d5073ed..e83aec4d198 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -125,7 +125,7 @@ class SharesPluginTest extends \Test\TestCase { $this->equalTo(false), $this->equalTo(-1) ) - ->willReturnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes){ + ->willReturnCallback(function ($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes) { if (in_array($requestedShareType, $shareTypes)) { $share = $this->createMock(IShare::class); $share->method('getShareType') @@ -191,7 +191,7 @@ class SharesPluginTest extends \Test\TestCase { ->with('/subdir') ->willReturn($node); - $dummyShares = array_map(function($type) { + $dummyShares = array_map(function ($type) { $share = $this->getMockBuilder(IShare::class)->getMock(); $share->expects($this->any()) ->method('getShareType') @@ -208,7 +208,7 @@ class SharesPluginTest extends \Test\TestCase { $this->equalTo(false), $this->equalTo(-1) ) - ->willReturnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes, $dummyShares){ + ->willReturnCallback(function ($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes, $dummyShares) { if ($node->getId() === 111 && in_array($requestedShareType, $shareTypes)) { foreach ($dummyShares as $dummyShare) { if ($dummyShare->getShareType() === $requestedShareType) { diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php index b3b21d2f32a..18f73d9685e 100644 --- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php +++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php @@ -82,7 +82,7 @@ class BirthdayCalendarControllerTest extends TestCase { $this->userManager->expects($this->once()) ->method('callForSeenUsers') - ->willReturnCallback(function($closure) { + ->willReturnCallback(function ($closure) { $user1 = $this->createMock(IUser::class); $user1->method('getUID')->willReturn('uid1'); $user2 = $this->createMock(IUser::class); diff --git a/apps/dav/tests/unit/Controller/DirectControllerTest.php b/apps/dav/tests/unit/Controller/DirectControllerTest.php index c24243e81e3..20e5888dfb0 100644 --- a/apps/dav/tests/unit/Controller/DirectControllerTest.php +++ b/apps/dav/tests/unit/Controller/DirectControllerTest.php @@ -143,7 +143,7 @@ class DirectControllerTest extends TestCase { }); $this->urlGenerator->method('getAbsoluteURL') - ->willReturnCallback(function(string $url) { + ->willReturnCallback(function (string $url) { return 'https://my.nextcloud/'.$url; }); diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index b703ef930e2..6e3a562e801 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -108,7 +108,7 @@ EOF; $called = false; $this->responseServer->expects($this->once()) ->method('handleITipMessage') - ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) { + ->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { $called = true; $this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); $this->assertEquals('VEVENT', $iTipMessage->component); @@ -164,7 +164,7 @@ EOF; $called = false; $this->responseServer->expects($this->once()) ->method('handleITipMessage') - ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) { + ->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { $called = true; $this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); $this->assertEquals('VEVENT', $iTipMessage->component); @@ -221,7 +221,7 @@ EOF; $called = false; $this->responseServer->expects($this->once()) ->method('handleITipMessage') - ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) { + ->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { $called = true; $this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); $this->assertEquals('VEVENT', $iTipMessage->component); @@ -304,7 +304,7 @@ EOF; $called = false; $this->responseServer->expects($this->once()) ->method('handleITipMessage') - ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) { + ->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { $called = true; $this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); $this->assertEquals('VEVENT', $iTipMessage->component); @@ -382,7 +382,7 @@ EOF; $called = false; $this->responseServer->expects($this->once()) ->method('handleITipMessage') - ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) { + ->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { $called = true; $this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); $this->assertEquals('VEVENT', $iTipMessage->component); diff --git a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php index 9dcf39d70f3..721c2c4b074 100644 --- a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php +++ b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php @@ -37,7 +37,7 @@ class AnonymousOptionsTest extends TestCase { private function sendRequest($method, $path, $userAgent = '') { $server = new Server(); $server->addPlugin(new AnonymousOptionsPlugin()); - $server->addPlugin(new Plugin(new BasicCallBack(function() { + $server->addPlugin(new Plugin(new BasicCallBack(function () { return false; }))); diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php index ef2634403e5..1143fd8192d 100644 --- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php +++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php @@ -124,7 +124,7 @@ class FilesDropPluginTest extends TestCase { ->willReturn('https://example.com'); $this->view->method('file_exists') - ->willReturnCallback(function($path) { + ->willReturnCallback(function ($path) { if ($path === 'file.txt' || $path === '/file.txt') { return true; } else { @@ -165,7 +165,7 @@ class FilesDropPluginTest extends TestCase { ->willReturn('https://example.com'); $this->view->method('file_exists') - ->willReturnCallback(function($path) { + ->willReturnCallback(function ($path) { if ($path === 'file.txt' || $path === '/file.txt') { return true; } else { diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php index 8d1b36f46cc..1b09c96c940 100644 --- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php +++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php @@ -78,7 +78,7 @@ class AppleProvisioningPluginTest extends TestCase { $this->themingDefaults, $this->request, $this->l10n, - function() { + function () { return 'generated-uuid'; } ); @@ -92,7 +92,7 @@ class AppleProvisioningPluginTest extends TestCase { $plugin = new AppleProvisioningPlugin($this->userSession, $this->urlGenerator, $this->themingDefaults, $this->request, $this->l10n, - function() {}); + function () {}); $server->expects($this->at(0)) ->method('on') diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php index 58779c0dd46..35a81a03d31 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php @@ -251,7 +251,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase { $this->tagManager->expects($this->exactly(3)) ->method('canUserSeeTag') - ->willReturnCallback(function($tag) { + ->willReturnCallback(function ($tag) { return $tag->isUserVisible(); }); diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php index b2af8024084..4e4612001d6 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php @@ -84,7 +84,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase { ->getMock(); $userFolder = $this->userFolder; - $closure = function($name) use ($userFolder) { + $closure = function ($name) use ($userFolder) { $nodes = $userFolder->getById(intval($name)); return !empty($nodes); }; diff --git a/apps/encryption/lib/AppInfo/Application.php b/apps/encryption/lib/AppInfo/Application.php index deea0967521..fcd7ef569b9 100644 --- a/apps/encryption/lib/AppInfo/Application.php +++ b/apps/encryption/lib/AppInfo/Application.php @@ -111,7 +111,7 @@ class Application extends \OCP\AppFramework\App { $this->encryptionManager->registerEncryptionModule( Encryption::ID, Encryption::DISPLAY_NAME, - function() use ($container) { + function () use ($container) { return new Encryption( $container->query('Crypt'), diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php index 4ac26cde64c..160c9794613 100644 --- a/apps/encryption/tests/Controller/SettingsControllerTest.php +++ b/apps/encryption/tests/Controller/SettingsControllerTest.php @@ -86,7 +86,7 @@ class SettingsControllerTest extends TestCase { $this->l10nMock->expects($this->any()) ->method('t') - ->willReturnCallback(function($message) { + ->willReturnCallback(function ($message) { return $message; }); diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php index 1f5f02a2920..fe2616f9c54 100644 --- a/apps/encryption/tests/Controller/StatusControllerTest.php +++ b/apps/encryption/tests/Controller/StatusControllerTest.php @@ -63,7 +63,7 @@ class StatusControllerTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->l10nMock->expects($this->any()) ->method('t') - ->willReturnCallback(function($message) { + ->willReturnCallback(function ($message) { return $message; }); $this->encryptionManagerMock = $this->createMock(IManager::class); diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index d222d94c16c..dd892616d0f 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -294,7 +294,7 @@ class CryptTest extends TestCase { * * @return array */ - public function dataProviderRemovePadding() { + public function dataProviderRemovePadding() { return [ ['dataxx', 'data'], ['data', false] diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index 7f67f701b50..f5fd3d2287f 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -322,7 +322,7 @@ class EncryptAllTest extends TestCase { $this->view->expects($this->any())->method('is_dir') ->willReturnCallback( - function($path) { + function ($path) { if ($path === '/user1/files/foo') { return true; } diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index 26e32c3a182..1e4cfad5e30 100644 --- a/apps/encryption/tests/Crypto/EncryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -323,7 +323,7 @@ class EncryptionTest extends TestCase { $this->keyManagerMock->expects($this->any()) ->method('addSystemKeys') - ->willReturnCallback(function($accessList, $publicKeys) { + ->willReturnCallback(function ($accessList, $publicKeys) { return $publicKeys; }); @@ -350,7 +350,7 @@ class EncryptionTest extends TestCase { $this->keyManagerMock->expects($this->never())->method('getPublicKey'); $this->keyManagerMock->expects($this->never())->method('addSystemKeys'); $this->keyManagerMock->expects($this->once())->method('setVersion') - ->willReturnCallback(function($path, $version, $view) { + ->willReturnCallback(function ($path, $version, $view) { $this->assertSame('path', $path); $this->assertSame(2, $version); $this->assertTrue($view instanceof \OC\Files\View); @@ -368,20 +368,20 @@ class EncryptionTest extends TestCase { $this->keyManagerMock->expects($this->any()) ->method('getPublicKey')->willReturnCallback( - function($user) { + function ($user) { throw new PublicKeyMissingException($user); } ); $this->keyManagerMock->expects($this->any()) ->method('addSystemKeys') - ->willReturnCallback(function($accessList, $publicKeys) { + ->willReturnCallback(function ($accessList, $publicKeys) { return $publicKeys; }); $this->cryptMock->expects($this->once())->method('multiKeyEncrypt') ->willReturnCallback( - function($fileKey, $publicKeys) { + function ($fileKey, $publicKeys) { $this->assertEmpty($publicKeys); $this->assertSame('fileKey', $fileKey); } diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php index 69f238d5ef7..2e2fce2b349 100644 --- a/apps/encryption/tests/KeyManagerTest.php +++ b/apps/encryption/tests/KeyManagerTest.php @@ -242,7 +242,7 @@ class KeyManagerTest extends TestCase { $this->keyStorageMock->expects($this->exactly(2)) ->method('getUserKey') - ->willReturnCallback(function ($uid, $keyID, $encryptionModuleId){ + ->willReturnCallback(function ($uid, $keyID, $encryptionModuleId) { if ($keyID === 'publicKey') { return ''; } @@ -473,13 +473,13 @@ class KeyManagerTest extends TestCase { $this->keyStorageMock->expects($this->any()) ->method('getSystemUserKey') - ->willReturnCallback(function($keyId, $encryptionModuleId) { + ->willReturnCallback(function ($keyId, $encryptionModuleId) { return $keyId; }); $this->utilMock->expects($this->any()) ->method('isRecoveryEnabledForUser') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if ($uid === 'user1') { return true; } diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index 8cf2aa0efc2..34666a62027 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -52,7 +52,7 @@ class Application extends App { $cloudFederationManager = $server->getCloudFederationProviderManager(); $cloudFederationManager->addCloudFederationProvider('file', 'Federated Files Sharing', - function() use ($container) { + function () use ($container) { $server = $container->getServer(); return new CloudFederationProviderFiles( $server->getAppManager(), @@ -72,7 +72,7 @@ class Application extends App { ); }); - $container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) { + $container->registerService('RequestHandlerController', function (SimpleContainer $c) use ($server) { $addressHandler = new AddressHandler( $server->getURLGenerator(), $server->getL10N('federatedfilesharing'), @@ -111,7 +111,7 @@ class Application extends App { $eventDispatcher->addListener( 'OCA\Files::loadAdditionalScripts', - function() use ($federatedShareProvider) { + function () use ($federatedShareProvider) { if ($federatedShareProvider->isIncomingServer2serverShareEnabled()) { \OCP\Util::addScript('federatedfilesharing', 'external'); } diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 88d2c68d479..123f669e74e 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -143,7 +143,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase { $this->addressHandler->expects($this->any())->method('splitUserRemote') ->with($shareWith) ->willReturnCallback( - function($shareWith) use ($validShareWith, $expectedReturnData) { + function ($shareWith) use ($validShareWith, $expectedReturnData) { if ($validShareWith) { return ['user', 'server']; } diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 7251f431eef..1c82c310c1f 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -98,7 +98,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->getMock(); $this->l = $this->getMockBuilder(IL10N::class)->getMock(); $this->l->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); diff --git a/apps/federation/lib/AppInfo/Application.php b/apps/federation/lib/AppInfo/Application.php index 7ea2f000029..119756b16e4 100644 --- a/apps/federation/lib/AppInfo/Application.php +++ b/apps/federation/lib/AppInfo/Application.php @@ -69,7 +69,7 @@ class Application extends App { ); $dispatcher = $container->getServer()->getEventDispatcher(); - $dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use($container) { + $dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function ($event) use ($container) { if ($event instanceof SabrePluginEvent) { $server = $event->getServer(); if ($server instanceof Server) { diff --git a/apps/federation/lib/Command/SyncFederationAddressBooks.php b/apps/federation/lib/Command/SyncFederationAddressBooks.php index 3080d469995..cad000cf71f 100644 --- a/apps/federation/lib/Command/SyncFederationAddressBooks.php +++ b/apps/federation/lib/Command/SyncFederationAddressBooks.php @@ -60,7 +60,7 @@ class SyncFederationAddressBooks extends Command { $progress = new ProgressBar($output); $progress->start(); - $this->syncService->syncThemAll(function($url, $ex) use ($progress, $output) { + $this->syncService->syncThemAll(function ($url, $ex) use ($progress, $output) { if ($ex instanceof \Exception) { $output->writeln("Error while syncing $url : " . $ex->getMessage()); diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php index b98e159585c..24e4cc21497 100644 --- a/apps/federation/lib/SyncJob.php +++ b/apps/federation/lib/SyncJob.php @@ -48,7 +48,7 @@ class SyncJob extends TimedJob { } protected function run($argument) { - $this->syncService->syncThemAll(function($url, $ex) { + $this->syncService->syncThemAll(function ($url, $ex) { if ($ex instanceof \Exception) { $this->logger->logException($ex, [ 'message' => "Error while syncing $url.", diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php index 1c4f5969513..a43ad557dae 100644 --- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php +++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php @@ -75,7 +75,7 @@ class AddServerMiddlewareTest extends TestCase { $this->l10n->expects($this->any())->method('t') ->willReturnCallback( - function($message) { + function ($message) { return $message; } ); diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index ac0650c664a..7e339d0f9f5 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -71,7 +71,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { /** @var \OCA\DAV\CardDAV\SyncService $syncService */ $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService); - $s->syncThemAll(function($url, $ex) { + $s->syncThemAll(function ($url, $ex) { $this->callBacks[] = [$url, $ex]; }); $this->assertEquals(1, count($this->callBacks)); @@ -99,7 +99,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { /** @var \OCA\DAV\CardDAV\SyncService $syncService */ $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService); - $s->syncThemAll(function($url, $ex) { + $s->syncThemAll(function ($url, $ex) { $this->callBacks[] = [$url, $ex]; }); $this->assertEquals(2, count($this->callBacks)); diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 5fe4d00ecd1..59b1c577e75 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -216,7 +216,7 @@ class TrustedServersTest extends TestCase { ->willReturn($server); $this->dispatcher->expects($this->once())->method('dispatch') ->willReturnCallback( - function($eventId, $event) { + function ($eventId, $event) { $this->assertSame($eventId, 'OCP\Federation\TrustedServerEvent::remove'); $this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); /** @var \Symfony\Component\EventDispatcher\GenericEvent $event */ diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index b043cfeb6ac..dd7ea19ba4a 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -74,7 +74,7 @@ class Application extends App { /** * Services */ - $container->registerService('TagService', function(IContainer $c) use ($server) { + $container->registerService('TagService', function (IContainer $c) use ($server) { $homeFolder = $c->query('ServerContainer')->getUserFolder(); return new TagService( $c->query('ServerContainer')->getUserSession(), diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php index 47f52fbcb87..cc587dcd80f 100644 --- a/apps/files_external/lib/AppInfo/Application.php +++ b/apps/files_external/lib/AppInfo/Application.php @@ -85,7 +85,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide $backendService = $container->query(BackendService::class); $backendService->registerBackendProvider($this); $backendService->registerAuthMechanismProvider($this); - $backendService->registerConfigHandler('user', function() use ($container) { + $backendService->registerConfigHandler('user', function () use ($container) { return $container->query(UserPlaceholderHandler::class); }); diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index 0d11fbb02ee..8f1cac49c69 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -127,7 +127,7 @@ class ConfigAdapter implements IMountProvider { $storageConfigs = $this->userGlobalStoragesService->getAllStoragesForUser(); - $storages = array_map(function(StorageConfig $storageConfig) use ($user) { + $storages = array_map(function (StorageConfig $storageConfig) use ($user) { try { $this->prepareStorageConfig($storageConfig, $user); return $this->constructStorage($storageConfig); @@ -138,7 +138,7 @@ class ConfigAdapter implements IMountProvider { }, $storageConfigs); - \OC\Files\Cache\Storage::getGlobalCache()->loadForStorageIds(array_map(function(Storage\IStorage $storage) { + \OC\Files\Cache\Storage::getGlobalCache()->loadForStorageIds(array_map(function (Storage\IStorage $storage) { return $storage->getId(); }, $storages)); @@ -157,7 +157,7 @@ class ConfigAdapter implements IMountProvider { return $storage; }, $storages, $storageConfigs); - $mounts = array_map(function(StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) { + $mounts = array_map(function (StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) { if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) { return new PersonalMount( $this->userStoragesService, diff --git a/apps/files_external/lib/Lib/Backend/Swift.php b/apps/files_external/lib/Lib/Backend/Swift.php index 86238b542b1..5d4d5ec1408 100644 --- a/apps/files_external/lib/Lib/Backend/Swift.php +++ b/apps/files_external/lib/Lib/Backend/Swift.php @@ -52,7 +52,7 @@ class Swift extends Backend { ->setFlag(DefinitionParameter::FLAG_OPTIONAL), ]) ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK) - ->setLegacyAuthMechanismCallback(function(array $params) use ($openstackAuth, $rackspaceAuth) { + ->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) { if (isset($params['options']['key']) && $params['options']['key']) { return $rackspaceAuth; } diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 96e557f48ff..de4d001fc4a 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -68,7 +68,7 @@ class FTP extends StreamWrapper{ } - public function getId(){ + public function getId() { return 'ftp::' . $this->user . '@' . $this->host . '/' . $this->root; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index d79c82446ae..acc4042f21b 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -169,7 +169,7 @@ class SFTP extends \OC\Files\Storage\Common { /** * {@inheritdoc} */ - public function getId(){ + public function getId() { $id = 'sftp::' . $this->user . '@' . $this->host; if ($this->port !== 22) { $id .= ':' . $this->port; diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php index b3a2bb8241a..6c2ea72b840 100644 --- a/apps/files_external/lib/Service/BackendService.php +++ b/apps/files_external/lib/Service/BackendService.php @@ -216,7 +216,7 @@ class BackendService { * @return Backend[] */ public function getAvailableBackends() { - return array_filter($this->getBackends(), function($backend) { + return array_filter($this->getBackends(), function ($backend) { return !$backend->checkDependencies(); }); } @@ -255,7 +255,7 @@ class BackendService { * @return AuthMechanism[] */ public function getAuthMechanismsByScheme(array $schemes) { - return array_filter($this->getAuthMechanisms(), function($authMech) use ($schemes) { + return array_filter($this->getAuthMechanisms(), function ($authMech) use ($schemes) { return in_array($authMech->getScheme(), $schemes, true); }); } diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 432bb6702fd..c02d9d71566 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -322,7 +322,7 @@ class OC_Mount_Config { } foreach ($dependencyGroups as $module => $dependants) { - $backends = implode(', ', array_map(function($backend) { + $backends = implode(', ', array_map(function ($backend) { return '"' . $backend->getText() . '"'; }, $dependants)); $message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>'; diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 45d4ac8406c..04c33f73b8b 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -134,10 +134,10 @@ <?php p($l->t('Add storage')); ?> </option> <?php - $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { + $sortedBackends = array_filter($_['backends'], function ($backend) use ($_) { return $backend->isVisibleFor($_['visibilityType']); }); - uasort($sortedBackends, function($a, $b) { + uasort($sortedBackends, function ($a, $b) { return strcasecmp($a->getText(), $b->getText()); }); ?> @@ -172,7 +172,7 @@ <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> <?php - $userBackends = array_filter($_['backends'], function($backend) { + $userBackends = array_filter($_['backends'], function ($backend) { return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); }); ?> diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php index b15ff00d21a..10853d9197c 100644 --- a/apps/files_external/tests/Backend/BackendTest.php +++ b/apps/files_external/tests/Backend/BackendTest.php @@ -78,7 +78,7 @@ class BackendTest extends \Test\TestCase { public function testLegacyAuthMechanismCallback() { $backend = new Backend(); - $backend->setLegacyAuthMechanismCallback(function(array $params) { + $backend->setLegacyAuthMechanismCallback(function (array $params) { if (isset($params['ping'])) { return 'pong'; } diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php index 9b61a32c3cc..ad5cb903214 100644 --- a/apps/files_external/tests/FrontendDefinitionTraitTest.php +++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php @@ -102,7 +102,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase { ->willReturn('param'); $param->expects($this->once()) ->method('validateValue') - ->willReturnCallback(function(&$value) { + ->willReturnCallback(function (&$value) { $value = 'foobar'; return true; }); diff --git a/apps/files_external/tests/Storage/FtpTest.php b/apps/files_external/tests/Storage/FtpTest.php index db2fd00341f..c4c947d6080 100644 --- a/apps/files_external/tests/Storage/FtpTest.php +++ b/apps/files_external/tests/Storage/FtpTest.php @@ -63,7 +63,7 @@ class FtpTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testConstructUrl(){ + public function testConstructUrl() { $config = [ 'host' => 'localhost', 'user' => 'ftp', 'password' => 'ftp', diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 14bbe68b446..2539b436592 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -181,7 +181,7 @@ class Application extends App { $server = $c->query('ServerContainer'); return new \OCA\Files_Sharing\External\MountProvider( $server->getDatabaseConnection(), - function() use ($c) { + function () use ($c) { return $c->query('ExternalManager'); }, $server->getCloudIdManager() @@ -215,19 +215,19 @@ class Application extends App { $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class); $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class); $dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class); - $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function() { + $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () { \OCP\Util::addScript('files_sharing', 'dist/collaboration'); }); $dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class); $dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class); // notifications api to accept incoming user shares - $dispatcher->addListener('OCP\Share::postShare', function(GenericEvent $event) { + $dispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) { /** @var Listener $listener */ $listener = $this->getContainer()->query(Listener::class); $listener->shareNotification($event); }); - $dispatcher->addListener(IGroup::class . '::postAddUser', function(GenericEvent $event) { + $dispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) { /** @var Listener $listener */ $listener = $this->getContainer()->query(Listener::class); $listener->userAddedToGroup($event); diff --git a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php index 61952dad15f..6dc0e06d6c6 100644 --- a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php +++ b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php @@ -74,7 +74,7 @@ class ShareRecipientSorter implements ISorter { // at least on PHP 5.6 usort turned out to be not stable. So we add // the current index to the value and compare it on a draw $i = 0; - $workArray = array_map(function($element) use (&$i) { + $workArray = array_map(function ($element) use (&$i) { return [$i++, $element]; }, $byType); diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 68729db6de8..833bc788687 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -602,7 +602,7 @@ class ShareAPIController extends OCSController { $shares = array_merge($userShares, $groupShares, $circleShares, $roomShares); - $shares = array_filter($shares, function(IShare $share) { + $shares = array_filter($shares, function (IShare $share) { return $share->getShareOwner() !== $this->currentUser; }); @@ -639,7 +639,7 @@ class ShareAPIController extends OCSController { $nodes = $folder->getDirectoryListing(); /** @var \OCP\Share\IShare[] $shares */ - $shares = array_reduce($nodes, function($carry, $node) { + $shares = array_reduce($nodes, function ($carry, $node) { $carry = array_merge($carry, $this->getAllShares($node, true)); return $carry; }, []); diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 63c96151ebc..898e57c1591 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -257,7 +257,7 @@ class ShareesAPIController extends OCSController { } private function sortShareesByFrequency(array $sharees): array { - usort($sharees, function(array $s1, array $s2) { + usort($sharees, function (array $s1, array $s2) { return $s2['count'] - $s1['count']; }); return $sharees; diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php index 548da79b9e1..33267a94c4e 100644 --- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php +++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php @@ -41,7 +41,7 @@ class DeleteOrphanedSharesJob extends TimedJob { /** * sets the correct interval for this timed job */ - public function __construct(){ + public function __construct() { $this->interval = $this->defaultIntervalMin * 60; } diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index 9845611b180..dd880d13306 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -155,7 +155,7 @@ class MountProvider implements IMountProvider { $result = []; // sort by stime, the super share will be based on the least recent share foreach ($tmp as &$tmp2) { - @usort($tmp2, function($a, $b) { + @usort($tmp2, function ($a, $b) { if ($a->getShareTime() <= $b->getShareTime()) { return -1; } diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index f2f1e24cc05..7713c8b6b11 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -112,7 +112,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection { $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); - $parents = array_map(function($parent) use ($qb) { + $parents = array_map(function ($parent) use ($qb) { return $qb->createNamedParameter($parent); }, $parents); diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 654ca3b450b..b8d5a21a739 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -108,7 +108,7 @@ class ApiTest extends TestCase { private function createOCS($userId) { $l = $this->getMockBuilder(IL10N::class)->getMock(); $l->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $config = $this->createMock(IConfig::class); diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 3f82675fedf..577f574f8ed 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -123,7 +123,7 @@ class ShareAPIControllerTest extends TestCase { $this->l = $this->createMock(IL10N::class); $this->l->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->config = $this->createMock(IConfig::class); @@ -180,7 +180,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager ->expects($this->exactly(5)) ->method('getShareById') - ->willReturnCallback(function($id) { + ->willReturnCallback(function ($id) { if ($id === 'ocinternal:42' || $id === 'ocRoomShare:42' || $id === 'ocFederatedSharing:42' || $id === 'ocCircleShare:42' || $id === 'ocMailShare:42') { throw new \OCP\Share\Exceptions\ShareNotFound(); } else { @@ -1341,7 +1341,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->method('formatShare') ->willReturnCallback( - function($share) { + function ($share) { return [ 'id' => $share->getId(), 'share_type' => $share->getShareType() @@ -1361,7 +1361,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager ->method('getSharesBy') ->willReturnCallback( - function($user, $shareType, $node) use ($shares) { + function ($user, $shareType, $node) use ($shares) { if (!isset($shares[$node->getName()]) || !isset($shares[$node->getName()][$shareType])) { return []; } @@ -1380,7 +1380,7 @@ class ShareAPIControllerTest extends TestCase { $this->groupManager ->method('isInGroup') ->willReturnCallback( - function($user, $group) { + function ($user, $group) { return $group === 'currentUserGroup'; } ); diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 240a0c7faad..a43c050634b 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -284,7 +284,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('core', 'shareapi_public_link_disclaimertext', null) ->willReturn('My disclaimer text'); - $this->userManager->method('get')->willReturnCallback(function(string $uid) use ($owner, $initiator) { + $this->userManager->method('get')->willReturnCallback(function (string $uid) use ($owner, $initiator) { if ($uid === 'ownerUID') { return $owner; } @@ -298,14 +298,14 @@ class ShareControllerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCA\Files_Sharing::loadAdditionalScripts', - $this->callback(function($event) use ($share) { + $this->callback(function ($event) use ($share) { return $event->getArgument('share') === $share; }) ); $this->l10n->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters) { + ->willReturnCallback(function ($text, $parameters) { return vsprintf($text, $parameters); }); @@ -432,7 +432,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('core', 'shareapi_public_link_disclaimertext', null) ->willReturn('My disclaimer text'); - $this->userManager->method('get')->willReturnCallback(function(string $uid) use ($owner, $initiator) { + $this->userManager->method('get')->willReturnCallback(function (string $uid) use ($owner, $initiator) { if ($uid === 'ownerUID') { return $owner; } @@ -446,14 +446,14 @@ class ShareControllerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCA\Files_Sharing::loadAdditionalScripts', - $this->callback(function($event) use ($share) { + $this->callback(function ($event) use ($share) { return $event->getArgument('share') === $share; }) ); $this->l10n->expects($this->any()) ->method('t') - ->will($this->returnCallback(function($text, $parameters) { + ->will($this->returnCallback(function ($text, $parameters) { return vsprintf($text, $parameters); })); @@ -583,7 +583,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('core', 'shareapi_public_link_disclaimertext', null) ->willReturn('My disclaimer text'); - $this->userManager->method('get')->willReturnCallback(function(string $uid) use ($owner, $initiator) { + $this->userManager->method('get')->willReturnCallback(function (string $uid) use ($owner, $initiator) { if ($uid === 'ownerUID') { return $owner; } @@ -597,14 +597,14 @@ class ShareControllerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCA\Files_Sharing::loadAdditionalScripts', - $this->callback(function($event) use ($share) { + $this->callback(function ($event) use ($share) { return $event->getArgument('share') === $share; }) ); $this->l10n->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters) { + ->willReturnCallback(function ($text, $parameters) { return vsprintf($text, $parameters); }); @@ -712,7 +712,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('token') ->willReturn($share); - $this->userManager->method('get')->willReturnCallback(function(string $uid) use ($owner, $initiator) { + $this->userManager->method('get')->willReturnCallback(function (string $uid) use ($owner, $initiator) { if ($uid === 'ownerUID') { return $owner; } @@ -724,7 +724,7 @@ class ShareControllerTest extends \Test\TestCase { $this->l10n->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters) { + ->willReturnCallback(function ($text, $parameters) { return vsprintf($text, $parameters); }); @@ -869,7 +869,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('token') ->willReturn($share); - $this->userManager->method('get')->willReturnCallback(function(string $uid) use ($owner, $initiator) { + $this->userManager->method('get')->willReturnCallback(function (string $uid) use ($owner, $initiator) { if ($uid === 'ownerUID') { return $owner; } @@ -910,7 +910,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('token') ->willReturn($share); - $this->userManager->method('get')->willReturnCallback(function(string $uid) use ($owner, $initiator) { + $this->userManager->method('get')->willReturnCallback(function (string $uid) use ($owner, $initiator) { if ($uid === 'ownerUID') { return $owner; } diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index 0f3f53a26f6..7beb4058c4f 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -292,7 +292,7 @@ class ShareesAPIControllerTest extends TestCase { $this->shareManager->expects($this->any()) ->method('shareProviderExists') - ->willReturnCallback(function($shareType) use ($emailSharingEnabled) { + ->willReturnCallback(function ($shareType) use ($emailSharingEnabled) { if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { return $emailSharingEnabled; } else { diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index bcab1a92bb8..cb078fdf832 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -456,7 +456,7 @@ class EtagPropagationTest extends PropagationTestCase { $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, \OCP\Share::SHARE_TYPE_USER, $node); /** @var \OCP\Share\IShare[] $shares */ - $shares = array_filter($shares, function(\OCP\Share\IShare $share) { + $shares = array_filter($shares, function (\OCP\Share\IShare $share) { return $share->getSharedWith() === self::TEST_FILES_SHARING_API_USER2; }); $this->assertCount(1, $shares); diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 5065c88afc7..5a1e8ad14e1 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -110,7 +110,7 @@ class ManagerTest extends TestCase { ] )->setMethods(['tryOCMEndPoint'])->getMock(); - $this->testMountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function() { + $this->testMountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function () { return $this->manager; }, new CloudIdManager()); } diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index 66df03101ac..cd1afb1f6ff 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -145,7 +145,7 @@ class MountProviderTest extends \Test\TestCase { ->willReturn($roomShares); $this->shareManager->expects($this->any()) ->method('newShare') - ->willReturnCallback(function() use ($rootFolder, $userManager) { + ->willReturnCallback(function () use ($rootFolder, $userManager) { return new \OC\Share20\Share($rootFolder, $userManager); }); $mounts = $this->provider->getMountsForUser($this->user, $this->loader); @@ -322,10 +322,10 @@ class MountProviderTest extends \Test\TestCase { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); - $userShares = array_map(function($shareSpec) { + $userShares = array_map(function ($shareSpec) { return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]); }, $userShares); - $groupShares = array_map(function($shareSpec) { + $groupShares = array_map(function ($shareSpec) { return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]); }, $groupShares); @@ -354,7 +354,7 @@ class MountProviderTest extends \Test\TestCase { ->willReturn($roomShares); $this->shareManager->expects($this->any()) ->method('newShare') - ->willReturnCallback(function() use ($rootFolder, $userManager) { + ->willReturnCallback(function () use ($rootFolder, $userManager) { return new \OC\Share20\Share($rootFolder, $userManager); }); diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index d2610020ec2..cda01aacba2 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -186,7 +186,7 @@ class SharedMountTest extends TestCase { * share file with a group if a user renames the file the filename should not change * for the other users */ - public function testMoveGroupShare () { + public function testMoveGroupShare() { $testGroup = $this->groupManager->createGroup('testGroup'); $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); @@ -266,7 +266,7 @@ class SharedMountTest extends TestCase { public function dataPermissionMovedGroupShare() { $data = []; - $powerset = function($permissions) { + $powerset = function ($permissions) { $results = [\OCP\Constants::PERMISSION_READ]; foreach ($permissions as $permission) { @@ -460,7 +460,7 @@ class SharedMountTest extends TestCase { } class DummyTestClassSharedMount extends \OCA\Files_Sharing\SharedMount { - public function __construct($storage, $mountpoint, $arguments = null, $loader = null){ + public function __construct($storage, $mountpoint, $arguments = null, $loader = null) { // noop } diff --git a/apps/files_trashbin/lib/AppInfo/Application.php b/apps/files_trashbin/lib/AppInfo/Application.php index 59f1b1d8c56..6a810e9218e 100644 --- a/apps/files_trashbin/lib/AppInfo/Application.php +++ b/apps/files_trashbin/lib/AppInfo/Application.php @@ -36,7 +36,7 @@ use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; class Application extends App { - public function __construct (array $urlParams = []) { + public function __construct(array $urlParams = []) { parent::__construct('files_trashbin', $urlParams); $container = $this->getContainer(); @@ -65,7 +65,7 @@ class Application extends App { ); }); - $container->registerService(ITrashManager::class, function(IAppContainer $c) { + $container->registerService(ITrashManager::class, function (IAppContainer $c) { return new TrashManager(); }); diff --git a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php index 2e9395980a9..3de365bd849 100644 --- a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php +++ b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php @@ -80,7 +80,7 @@ class ExpireTrash extends \OC\BackgroundJob\TimedJob { return; } - $this->userManager->callForSeenUsers(function(IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user) { $uid = $user->getUID(); if (!$this->setupFS($uid)) { return; diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php index 6b35f781a56..46d2de46e36 100644 --- a/apps/files_trashbin/lib/Command/ExpireTrash.php +++ b/apps/files_trashbin/lib/Command/ExpireTrash.php @@ -92,7 +92,7 @@ class ExpireTrash extends Command { } else { $p = new ProgressBar($output); $p->start(); - $this->userManager->callForSeenUsers(function(IUser $user) use ($p) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($p) { $p->advance(); $this->expireTrashForUser($user); }); diff --git a/apps/files_trashbin/lib/Expiration.php b/apps/files_trashbin/lib/Expiration.php index 03c45ad4a6d..9a660f9e942 100644 --- a/apps/files_trashbin/lib/Expiration.php +++ b/apps/files_trashbin/lib/Expiration.php @@ -50,7 +50,7 @@ class Expiration { /** @var bool */ private $canPurgeToSaveSpace; - public function __construct(IConfig $config,ITimeFactory $timeFactory){ + public function __construct(IConfig $config,ITimeFactory $timeFactory) { $this->timeFactory = $timeFactory; $this->setRetentionObligation($config->getSystemValue('trashbin_retention_obligation', 'auto')); } @@ -67,7 +67,7 @@ class Expiration { * Is trashbin expiration enabled * @return bool */ - public function isEnabled(){ + public function isEnabled() { return $this->retentionObligation !== 'disabled'; } @@ -77,7 +77,7 @@ class Expiration { * @param bool $quotaExceeded * @return bool */ - public function isExpired($timestamp, $quotaExceeded = false){ + public function isExpired($timestamp, $quotaExceeded = false) { // No expiration if disabled if (!$this->isEnabled()) { return false; @@ -126,7 +126,7 @@ class Expiration { return $maxAge; } - private function parseRetentionObligation(){ + private function parseRetentionObligation() { $splitValues = explode(',', $this->retentionObligation); if (!isset($splitValues[0])) { $minValue = self::DEFAULT_RETENTION_OBLIGATION; diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 0f1787223a2..24d49a4c8c5 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -549,7 +549,7 @@ class Trashbin { * wrapper function to emit the 'preDelete' hook of \OCP\Trashbin before a file is deleted * @param string $path */ - protected static function emitTrashbinPreDelete($path){ + protected static function emitTrashbinPreDelete($path) { \OC_Hook::emit('\OCP\Trashbin', 'preDelete', ['path' => $path]); } @@ -557,7 +557,7 @@ class Trashbin { * wrapper function to emit the 'delete' hook of \OCP\Trashbin after a file has been deleted * @param string $path */ - protected static function emitTrashbinPostDelete($path){ + protected static function emitTrashbinPostDelete($path) { \OC_Hook::emit('\OCP\Trashbin', 'delete', ['path' => $path]); } diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php index 5a21889e457..581ef247ac7 100644 --- a/apps/files_trashbin/tests/ExpirationTest.php +++ b/apps/files_trashbin/tests/ExpirationTest.php @@ -32,7 +32,7 @@ class ExpirationTest extends \Test\TestCase { const FAKE_TIME_NOW = 1000000; - public function expirationData(){ + public function expirationData() { $today = 100*self::SECONDS_PER_DAY; $back10Days = (100-10)*self::SECONDS_PER_DAY; $back20Days = (100-20)*self::SECONDS_PER_DAY; @@ -105,7 +105,7 @@ class ExpirationTest extends \Test\TestCase { * @param bool $quotaExceeded * @param string $expectedResult */ - public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult){ + public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); @@ -116,7 +116,7 @@ class ExpirationTest extends \Test\TestCase { } - public function configData(){ + public function configData() { return [ [ 'disabled', null, null, null], [ 'auto', Expiration::DEFAULT_RETENTION_OBLIGATION, Expiration::NO_OBLIGATION, true ], @@ -138,7 +138,7 @@ class ExpirationTest extends \Test\TestCase { * @param int $expectedMaxAge * @param bool $expectedCanPurgeToSaveSpace */ - public function testParseRetentionObligation($configValue, $expectedMinAge, $expectedMaxAge, $expectedCanPurgeToSaveSpace){ + public function testParseRetentionObligation($configValue, $expectedMinAge, $expectedMaxAge, $expectedCanPurgeToSaveSpace) { $mockedConfig = $this->getMockedConfig($configValue); $mockedTimeFactory = $this->getMockedTimeFactory( time() @@ -151,7 +151,7 @@ class ExpirationTest extends \Test\TestCase { } - public function timestampTestData(){ + public function timestampTestData() { return [ [ 'disabled', false], [ 'auto', false ], @@ -171,7 +171,7 @@ class ExpirationTest extends \Test\TestCase { * @param string $configValue * @param int $expectedMaxAgeTimestamp */ - public function testGetMaxAgeAsTimestamp($configValue, $expectedMaxAgeTimestamp){ + public function testGetMaxAgeAsTimestamp($configValue, $expectedMaxAgeTimestamp) { $mockedConfig = $this->getMockedConfig($configValue); $mockedTimeFactory = $this->getMockedTimeFactory( self::FAKE_TIME_NOW @@ -186,7 +186,7 @@ class ExpirationTest extends \Test\TestCase { * @param int $time * @return ITimeFactory|MockObject */ - private function getMockedTimeFactory($time){ + private function getMockedTimeFactory($time) { $mockedTimeFactory = $this->createMock(ITimeFactory::class); $mockedTimeFactory->expects($this->any()) ->method('getTime') @@ -199,7 +199,7 @@ class ExpirationTest extends \Test\TestCase { * @param string $returnValue * @return IConfig|MockObject */ - private function getMockedConfig($returnValue){ + private function getMockedConfig($returnValue) { $mockedConfig = $this->createMock(IConfig::class); $mockedConfig->expects($this->any()) ->method('getSystemValue') diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index 32ba9d40505..040b72a8f0a 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -75,7 +75,7 @@ class Application extends App { ); }); - $container->registerService(IVersionManager::class, function(IAppContainer $c) { + $container->registerService(IVersionManager::class, function (IAppContainer $c) { return new VersionManager(); }); diff --git a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php index cb2e0abb0c4..eb4287376e9 100644 --- a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php +++ b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php @@ -58,7 +58,7 @@ class ExpireVersions extends \OC\BackgroundJob\TimedJob { return; } - $this->userManager->callForSeenUsers(function(IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user) { $uid = $user->getUID(); if (!$this->setupFS($uid)) { return; diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php index ba12ce2a496..d67542db259 100644 --- a/apps/files_versions/lib/Command/ExpireVersions.php +++ b/apps/files_versions/lib/Command/ExpireVersions.php @@ -91,7 +91,7 @@ class ExpireVersions extends Command { } else { $p = new ProgressBar($output); $p->start(); - $this->userManager->callForSeenUsers(function(IUser $user) use ($p) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($p) { $p->advance(); $this->expireVersionsForUser($user); }); diff --git a/apps/files_versions/lib/Expiration.php b/apps/files_versions/lib/Expiration.php index 6959de6a943..d57bc20dc81 100644 --- a/apps/files_versions/lib/Expiration.php +++ b/apps/files_versions/lib/Expiration.php @@ -47,7 +47,7 @@ class Expiration { /** @var bool */ private $canPurgeToSaveSpace; - public function __construct(IConfig $config,ITimeFactory $timeFactory){ + public function __construct(IConfig $config,ITimeFactory $timeFactory) { $this->timeFactory = $timeFactory; $this->retentionObligation = $config->getSystemValue('versions_retention_obligation', 'auto'); @@ -60,14 +60,14 @@ class Expiration { * Is versions expiration enabled * @return bool */ - public function isEnabled(){ + public function isEnabled() { return $this->retentionObligation !== 'disabled'; } /** * Is default expiration active */ - public function shouldAutoExpire(){ + public function shouldAutoExpire() { return $this->minAge === self::NO_OBLIGATION || $this->maxAge === self::NO_OBLIGATION; } @@ -78,7 +78,7 @@ class Expiration { * @param bool $quotaExceeded * @return bool */ - public function isExpired($timestamp, $quotaExceeded = false){ + public function isExpired($timestamp, $quotaExceeded = false) { // No expiration if disabled if (!$this->isEnabled()) { return false; @@ -119,7 +119,7 @@ class Expiration { * Get maximal retention obligation as a timestamp * @return int */ - public function getMaxAgeAsTimestamp(){ + public function getMaxAgeAsTimestamp() { $maxAge = false; if ($this->isEnabled() && $this->maxAge !== self::NO_OBLIGATION) { $time = $this->timeFactory->getTime(); @@ -132,7 +132,7 @@ class Expiration { * Read versions_retention_obligation, validate it * and set private members accordingly */ - private function parseRetentionObligation(){ + private function parseRetentionObligation() { $splitValues = explode(',', $this->retentionObligation); if (!isset($splitValues[0])) { $minValue = 'auto'; diff --git a/apps/files_versions/lib/Hooks.php b/apps/files_versions/lib/Hooks.php index b45b082865d..179a404ed9a 100644 --- a/apps/files_versions/lib/Hooks.php +++ b/apps/files_versions/lib/Hooks.php @@ -56,7 +56,7 @@ class Hooks { /** * listen to write event. */ - public static function write_hook( $params ) { + public static function write_hook($params) { $path = $params[Filesystem::signal_param_path]; if($path !== '') { Storage::store($path); diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index b1d6c689c61..1c4e424ec78 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -497,7 +497,7 @@ class Storage { * Expire versions that older than max version retention time * @param string $uid */ - public static function expireOlderThanMaxForUser($uid){ + public static function expireOlderThanMaxForUser($uid) { $expiration = self::getExpiration(); $threshold = $expiration->getMaxAgeAsTimestamp(); $versions = self::getAllVersions($uid); @@ -848,7 +848,7 @@ class Storage { * Static workaround * @return Expiration */ - protected static function getExpiration(){ + protected static function getExpiration() { if (self::$application === null) { self::$application = \OC::$server->query(Application::class); } diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index 1153d53bbaa..426d07e4b42 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/tests/ExpirationTest.php @@ -33,7 +33,7 @@ use PHPUnit\Framework\MockObject\MockObject; class ExpirationTest extends \Test\TestCase { const SECONDS_PER_DAY = 86400; //60*60*24 - public function expirationData(){ + public function expirationData() { $today = 100*self::SECONDS_PER_DAY; $back10Days = (100-10)*self::SECONDS_PER_DAY; $back20Days = (100-20)*self::SECONDS_PER_DAY; @@ -106,7 +106,7 @@ class ExpirationTest extends \Test\TestCase { * @param bool $quotaExceeded * @param string $expectedResult */ - public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult){ + public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); @@ -117,7 +117,7 @@ class ExpirationTest extends \Test\TestCase { } - public function configData(){ + public function configData() { return [ [ 'disabled', null, null, null], [ 'auto', Expiration::NO_OBLIGATION, Expiration::NO_OBLIGATION, true ], @@ -141,7 +141,7 @@ class ExpirationTest extends \Test\TestCase { * @param int $expectedMaxAge * @param bool $expectedCanPurgeToSaveSpace */ - public function testParseRetentionObligation($configValue, $expectedMinAge, $expectedMaxAge, $expectedCanPurgeToSaveSpace){ + public function testParseRetentionObligation($configValue, $expectedMinAge, $expectedMaxAge, $expectedCanPurgeToSaveSpace) { $mockedConfig = $this->getMockedConfig($configValue); $mockedTimeFactory = $this->getMockedTimeFactory( time() @@ -157,7 +157,7 @@ class ExpirationTest extends \Test\TestCase { * @param int $time * @return ITimeFactory|MockObject */ - private function getMockedTimeFactory($time){ + private function getMockedTimeFactory($time) { $mockedTimeFactory = $this->createMock(ITimeFactory::class); $mockedTimeFactory->expects($this->any()) ->method('getTime') @@ -170,7 +170,7 @@ class ExpirationTest extends \Test\TestCase { * @param string $returnValue * @return IConfig|MockObject */ - private function getMockedConfig($returnValue){ + private function getMockedConfig($returnValue) { $mockedConfig = $this->createMock(IConfig::class); $mockedConfig->expects($this->any()) ->method('getSystemValue') diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index aa572a36ea9..ae052335a95 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -746,7 +746,7 @@ class VersioningTest extends \Test\TestCase { $eventHandler->expects($this->any()) ->method('callback') ->willReturnCallback( - function($p) use (&$params) { + function ($p) use (&$params) { $params = $p; } ); diff --git a/apps/lookup_server_connector/lib/AppInfo/Application.php b/apps/lookup_server_connector/lib/AppInfo/Application.php index c4ae3e6a97a..aad11c4eff4 100644 --- a/apps/lookup_server_connector/lib/AppInfo/Application.php +++ b/apps/lookup_server_connector/lib/AppInfo/Application.php @@ -33,7 +33,7 @@ use OCP\IUser; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App { - public function __construct () { + public function __construct() { parent::__construct('lookup_server_connector'); } @@ -49,7 +49,7 @@ class Application extends App { */ public function registerHooksAndEvents(): void { $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); - $dispatcher->addListener('OC\AccountManager::userUpdated', static function(GenericEvent $event) { + $dispatcher->addListener('OC\AccountManager::userUpdated', static function (GenericEvent $event) { /** @var IUser $user */ $user = $event->getSubject(); diff --git a/apps/provisioning_api/lib/AppInfo/Application.php b/apps/provisioning_api/lib/AppInfo/Application.php index 96ec5242ee0..6d99c48be5d 100644 --- a/apps/provisioning_api/lib/AppInfo/Application.php +++ b/apps/provisioning_api/lib/AppInfo/Application.php @@ -43,7 +43,7 @@ class Application extends App { $container = $this->getContainer(); $server = $container->getServer(); - $container->registerService(NewUserMailHelper::class, function(SimpleContainer $c) use ($server) { + $container->registerService(NewUserMailHelper::class, function (SimpleContainer $c) use ($server) { return new NewUserMailHelper( $server->query(Defaults::class), $server->getURLGenerator(), @@ -56,7 +56,7 @@ class Application extends App { Util::getDefaultEmailAddress('no-reply') ); }); - $container->registerService('ProvisioningApiMiddleware', function(SimpleContainer $c) use ($server) { + $container->registerService('ProvisioningApiMiddleware', function (SimpleContainer $c) use ($server) { $user = $server->getUserManager()->get($c['UserId']); $isAdmin = $user !== null ? $server->getGroupManager()->isAdmin($user->getUID()) : false; $isSubAdmin = $user !== null ? $server->getGroupManager()->getSubAdmin()->isSubAdmin($user) : false; diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index 6d02dcc0cd6..aa774506853 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -93,7 +93,7 @@ class GroupsController extends AUserData { */ public function getGroups(string $search = '', int $limit = null, int $offset = 0): DataResponse { $groups = $this->groupManager->search($search, $limit, $offset); - $groups = array_map(function($group) { + $groups = array_map(function ($group) { /** @var IGroup $group */ return $group->getGID(); }, $groups); @@ -113,7 +113,7 @@ class GroupsController extends AUserData { */ public function getGroupsDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse { $groups = $this->groupManager->search($search, $limit, $offset); - $groups = array_map(function($group) { + $groups = array_map(function ($group) { /** @var IGroup $group */ return [ 'id' => $group->getGID(), @@ -166,7 +166,7 @@ class GroupsController extends AUserData { if($this->groupManager->isAdmin($user->getUID()) || $isSubadminOfGroup) { $users = $this->groupManager->get($groupId)->getUsers(); - $users = array_map(function($user) { + $users = array_map(function ($user) { /** @var IUser $user */ return $user->getUID(); }, $users); diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index f5969c01526..0469fee0f71 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -168,7 +168,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->subAdminManager ->method('isSubAdminOfGroup') - ->willReturnCallback(function($_user, $_group) use ($user, $group) { + ->willReturnCallback(function ($_user, $_group) use ($user, $group) { if ($_user === $user && $_group === $group) { return true; } @@ -179,7 +179,7 @@ class GroupsControllerTest extends \Test\TestCase { private function useAccountManager() { $this->accountManager->expects($this->any()) ->method('getUser') - ->willReturnCallback(function(IUser $user) { + ->willReturnCallback(function (IUser $user) { return [ AccountManager::PROPERTY_PHONE => ['value' => '0800-call-' . $user->getUID()], AccountManager::PROPERTY_ADDRESS => ['value' => 'Holzweg 99, 0601 Herrera, Panama'], @@ -496,7 +496,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function(string $uid) use ($users) { + ->willReturnCallback(function (string $uid) use ($users) { return isset($users[$uid]) ? $users[$uid] : null; }); diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index a5a79c23ebd..aff12547ec0 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -439,7 +439,7 @@ class UsersControllerTest extends TestCase { $this->config ->expects($this->any()) ->method('getAppValue') - ->willReturnCallback(function($appid, $key, $default) { + ->willReturnCallback(function ($appid, $key, $default) { if($key === 'newUser.generateUserID') { return 'yes'; } @@ -477,7 +477,7 @@ class UsersControllerTest extends TestCase { $this->secureRandom->expects($this->any()) ->method('generate') ->with(10) - ->willReturnCallback(function() { return (string)rand(1000000000, 9999999999); }); + ->willReturnCallback(function () { return (string)rand(1000000000, 9999999999); }); $this->assertTrue(key_exists( 'id', @@ -494,7 +494,7 @@ class UsersControllerTest extends TestCase { $this->config ->expects($this->any()) ->method('getAppValue') - ->willReturnCallback(function($appid, $key, $default) { + ->willReturnCallback(function ($appid, $key, $default) { if($key === 'newUser.generateUserID') { return 'yes'; } @@ -537,7 +537,7 @@ class UsersControllerTest extends TestCase { $this->config ->expects($this->any()) ->method('getAppValue') - ->willReturnCallback(function($appid, $key, $default) { + ->willReturnCallback(function ($appid, $key, $default) { if($key === 'newUser.requireEmail') { return 'yes'; } diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index 230b2377cda..f53a5ddcf51 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -60,7 +60,7 @@ class Application extends App { /** * @param array $urlParams */ - public function __construct(array $urlParams=[]){ + public function __construct(array $urlParams=[]) { parent::__construct(self::APP_ID, $urlParams); $container = $this->getContainer(); @@ -73,11 +73,11 @@ class Application extends App { * Core class wrappers */ /** FIXME: Remove once OC_User is non-static and mockable */ - $container->registerService('isAdmin', function() { + $container->registerService('isAdmin', function () { return \OC_User::isAdminUser(\OC_User::getUser()); }); /** FIXME: Remove once OC_SubAdmin is non-static and mockable */ - $container->registerService('isSubAdmin', function(IContainer $c) { + $container->registerService('isSubAdmin', function (IContainer $c) { $userObject = \OC::$server->getUserSession()->getUser(); $isSubAdmin = false; if($userObject !== null) { @@ -85,7 +85,7 @@ class Application extends App { } return $isSubAdmin; }); - $container->registerService('userCertificateManager', function(IContainer $c) { + $container->registerService('userCertificateManager', function (IContainer $c) { return $c->query('ServerContainer')->getCertificateManager(); }, false); $container->registerService('systemCertificateManager', function (IContainer $c) { diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index e822436702f..f40a8024b6d 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -247,7 +247,7 @@ class AppSettingsController extends Controller { $dependencyAnalyzer = new DependencyAnalyzer(new Platform($this->config), $this->l10n); // Extend existing app details - $apps = array_map(function($appData) use ($dependencyAnalyzer) { + $apps = array_map(function ($appData) use ($dependencyAnalyzer) { if (isset($appData['appstoreData'])) { $appstoreData = $appData['appstoreData']; $appData['screenshot'] = isset($appstoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/' . base64_encode($appstoreData['screenshots'][0]['url']) : ''; diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index 395412cbb6f..5a4ebd122f8 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -184,7 +184,7 @@ class UsersController extends Controller { if(!$isLDAPUsed) { if ($this->isAdmin) { $disabledUsers = $this->userManager->countDisabledUsers(); - $userCount = array_reduce($this->userManager->countUsers(), function($v, $w) { + $userCount = array_reduce($this->userManager->countUsers(), function ($v, $w) { return $v + (int)$w; }, 0); } else { diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index 3bf1f23d752..e6bc4388359 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -175,7 +175,7 @@ class PersonalInfo implements ISettings { */ private function getGroups(IUser $user) { $groups = array_map( - function(IGroup $group) { + function (IGroup $group) { return $group->getDisplayName(); }, $this->groupManager->getUserGroups($user) @@ -239,7 +239,7 @@ class PersonalInfo implements ISettings { $localeCodes = $this->l10nFactory->findAvailableLocales(); - $userLocale = array_filter($localeCodes, function($value) use ($userLocaleString) { + $userLocale = array_filter($localeCodes, function ($value) use ($userLocaleString) { return $userLocaleString === $value['code']; }); @@ -248,7 +248,7 @@ class PersonalInfo implements ISettings { $userLocale = reset($userLocale); } - $localesForLanguage = array_filter($localeCodes, function($localeCode) use ($userLang) { + $localesForLanguage = array_filter($localeCodes, function ($localeCode) use ($userLang) { return 0 === strpos($localeCode['code'], $userLang); }); diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index db4e4580693..f00be40b243 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -116,7 +116,7 @@ class CheckSetupControllerTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->l10n->expects($this->any()) ->method('t') - ->willReturnCallback(function($message, array $replace) { + ->willReturnCallback(function ($message, array $replace) { return vsprintf($message, $replace); }); $this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class) @@ -513,7 +513,7 @@ class CheckSetupControllerTest extends TestCase { ->willReturn(true); $this->urlGenerator->method('linkToDocs') - ->willReturnCallback(function(string $key): string { + ->willReturnCallback(function (string $key): string { if ($key === 'admin-performance') { return 'http://docs.example.org/server/go.php?to=admin-performance'; } @@ -536,7 +536,7 @@ class CheckSetupControllerTest extends TestCase { }); $this->urlGenerator->method('getAbsoluteURL') - ->willReturnCallback(function(string $url): string { + ->willReturnCallback(function (string $url): string { if ($url === 'index.php/settings/admin') { return 'https://server/index.php/settings/admin'; } @@ -1391,7 +1391,7 @@ Array */ public function testIsMysqlUsedWithoutUTF8MB4(string $db, bool $useUTF8MB4, bool $expected) { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) use ($db, $useUTF8MB4) { + ->willReturnCallback(function ($key, $default) use ($db, $useUTF8MB4) { if ($key === 'dbtype') { return $db; } @@ -1439,7 +1439,7 @@ Array */ public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $mode, string $className, bool $expected) { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) use ($mode, $className) { + ->willReturnCallback(function ($key, $default) use ($mode, $className) { if ($key === 'objectstore' && $mode === 'singlebucket') { return ['class' => $className]; } diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index f0996045006..7d17ac80407 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -160,7 +160,7 @@ class MailSettingsControllerTest extends \Test\TestCase { $this->l->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->userSession diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 9253c9d7d2e..65258252016 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -113,7 +113,7 @@ class UsersControllerTest extends \Test\TestCase { $this->encryptionModule = $this->createMock(IEncryptionModule::class); $this->encryptionManager->expects($this->any())->method('getEncryptionModules') - ->willReturn(['encryptionModule' => ['callback' => function() { return $this->encryptionModule;}]]); + ->willReturn(['encryptionModule' => ['callback' => function () { return $this->encryptionModule;}]]); } @@ -540,7 +540,7 @@ class UsersControllerTest extends \Test\TestCase { ->willReturn($encryptionEnabled); $this->encryptionManager->expects($this->any()) ->method('getEncryptionModule') - ->willReturnCallback(function() use ($encryptionModuleLoaded) { + ->willReturnCallback(function () use ($encryptionModuleLoaded) { if ($encryptionModuleLoaded) return $this->encryptionModule; else throw new ModuleDoesNotExistsException(); }); diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index 0c6d26151b1..c32bb601f31 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -90,7 +90,7 @@ class NewUserMailHelperTest extends TestCase { $this->config ->expects($this->any()) ->method('getSystemValue') - ->willReturnCallback(function($arg) { + ->willReturnCallback(function ($arg) { switch ($arg) { case 'secret': return 'MyInstanceWideSecret'; diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index d864af9d511..f340fbfa35d 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -113,7 +113,7 @@ class ShareByMailProviderTest extends TestCase { $this->l = $this->getMockBuilder(IL10N::class)->getMock(); $this->l->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); @@ -375,7 +375,7 @@ class ShareByMailProviderTest extends TestCase { ->with('files_sharing.sharecontroller.showShare', ['token' => 'token']); $instance->expects($this->once())->method('sendMailNotification') ->willReturnCallback( - function() { + function () { throw new \Exception('should be converted to a hint exception'); } ); diff --git a/apps/systemtags/appinfo/app.php b/apps/systemtags/appinfo/app.php index 5bd5c42d482..3764ff4a88f 100644 --- a/apps/systemtags/appinfo/app.php +++ b/apps/systemtags/appinfo/app.php @@ -32,14 +32,14 @@ use OCA\SystemTags\Activity\Listener; $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener( 'OCA\Files::loadAdditionalScripts', - function() { + function () { // FIXME: no public API for these ? \OCP\Util::addScript('dist/systemtags'); \OCP\Util::addScript('systemtags', 'systemtags'); } ); -$managerListener = function(ManagerEvent $event) { +$managerListener = function (ManagerEvent $event) { /** @var \OCA\SystemTags\Activity\Listener $listener */ $listener = \OC::$server->query(Listener::class); $listener->event($event); @@ -49,7 +49,7 @@ $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); $eventDispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); -$mapperListener = function(MapperEvent $event) { +$mapperListener = function (MapperEvent $event) { $application = new \OCP\AppFramework\App('systemtags'); /** @var \OCA\SystemTags\Activity\Listener $listener */ $listener = \OC::$server->query(Listener::class); diff --git a/apps/systemtags/lib/Controller/LastUsedController.php b/apps/systemtags/lib/Controller/LastUsedController.php index 5100f6769c6..10707463d48 100644 --- a/apps/systemtags/lib/Controller/LastUsedController.php +++ b/apps/systemtags/lib/Controller/LastUsedController.php @@ -55,6 +55,6 @@ class LastUsedController extends Controller { public function getLastUsedTagIds() { $lastUsed = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'systemtags', 'last_used', '[]'); $tagIds = json_decode($lastUsed, true); - return new DataResponse(array_map(function($id) { return (string) $id; }, $tagIds)); + return new DataResponse(array_map(function ($id) { return (string) $id; }, $tagIds)); } } diff --git a/apps/testing/lib/AppInfo/Application.php b/apps/testing/lib/AppInfo/Application.php index e57531a8d2a..f5eb2ef9b30 100644 --- a/apps/testing/lib/AppInfo/Application.php +++ b/apps/testing/lib/AppInfo/Application.php @@ -28,7 +28,7 @@ use OCA\Testing\AlternativeHomeUserBackend; use OCP\AppFramework\App; class Application extends App { - public function __construct (array $urlParams = []) { + public function __construct(array $urlParams = []) { $appName = 'testing'; parent::__construct($appName, $urlParams); diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index fc07ac6619d..76dd0137020 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -180,7 +180,7 @@ class ThemingDefaults extends \OC_Defaults { ]; $navigation = $this->navigationManager->getAll(INavigationManager::TYPE_GUEST); - $guestNavigation = array_map(function($nav) { + $guestNavigation = array_map(function ($nav) { return [ 'text' => $nav['name'], 'url' => $nav['href'] diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php index d70a03923ff..1f871d101d8 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -181,13 +181,13 @@ class CapabilitiesTest extends TestCase { ->willReturn($background); $this->url->expects($this->exactly(4)) ->method('getAbsoluteURL') - ->willReturnCallback(function($url) use($baseUrl) { + ->willReturnCallback(function ($url) use ($baseUrl) { return $baseUrl . $url; }); } else { $this->url->expects($this->exactly(3)) ->method('getAbsoluteURL') - ->willReturnCallback(function($url) use($baseUrl) { + ->willReturnCallback(function ($url) use ($baseUrl) { return $baseUrl . $url; }); } diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 240cca776c0..d1890f7df5c 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -151,7 +151,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->once()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); $this->scssCacher @@ -210,7 +210,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -241,7 +241,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -289,7 +289,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -333,7 +333,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -394,7 +394,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -470,7 +470,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -544,7 +544,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -602,7 +602,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); @@ -641,7 +641,7 @@ class ThemingControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($str) { + ->willReturnCallback(function ($str) { return $str; }); diff --git a/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php b/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php index a2e9a154d9f..61dbffb3214 100644 --- a/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php +++ b/apps/twofactor_backupcodes/lib/BackgroundJob/CheckBackupCodes.php @@ -57,7 +57,7 @@ class CheckBackupCodes extends QueuedJob { } protected function run($argument) { - $this->userManager->callForSeenUsers(function(IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user) { $providers = $this->registry->getProviderStates($user); $isTwoFactorAuthenticated = $this->twofactorManager->isTwoFactorAuthenticated($user); diff --git a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php index 7182ad561aa..4877be9fa37 100644 --- a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php +++ b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php @@ -72,7 +72,7 @@ class RememberBackupCodesJob extends TimedJob { } $providers = $this->registry->getProviderStates($user); - $state2fa = array_reduce($providers, function(bool $carry, bool $state) { + $state2fa = array_reduce($providers, function (bool $carry, bool $state) { return $carry || $state; }, false); diff --git a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php index b742f606c61..6d60f589e52 100644 --- a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php +++ b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php @@ -143,7 +143,7 @@ class BackupCodesProvider implements IProvider, IProvidesPersonalSettings { * @return boolean */ public function isActive(IUser $user): bool { - $appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function($appId) { + $appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function ($appId) { return $appId !== $this->appName; }); foreach ($appIds as $appId) { diff --git a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php index 21e8f853823..3b443c9fe6b 100644 --- a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php @@ -69,7 +69,7 @@ class CheckBackupCodeTest extends TestCase { $this->user = $this->createMock(IUser::class); $this->userManager->method('callForSeenUsers') - ->willReturnCallback(function(\Closure $e) { + ->willReturnCallback(function (\Closure $e) { $e($this->user); }); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php index 33f9de858a4..99d11504710 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php @@ -68,7 +68,7 @@ class ClearNotificationsTest extends TestCase { $this->notificationManager->expects($this->once()) ->method('markProcessed') - ->with($this->callback(function(INotification $n) { + ->with($this->callback(function (INotification $n) { return $n->getUser() === 'fritz' && $n->getApp() === 'twofactor_backupcodes' && $n->getObjectType() === 'create' && diff --git a/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php b/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php index e0cfa80b29a..996dba1a9b6 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php @@ -53,7 +53,7 @@ class NotifierTest extends TestCase { $this->l = $this->createMock(IL10N::class); $this->l->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return vsprintf($string, $args); }); $this->factory = $this->createMock(IFactory::class); diff --git a/apps/updatenotification/lib/Controller/APIController.php b/apps/updatenotification/lib/Controller/APIController.php index 2f3505b5047..255a56e1e9a 100644 --- a/apps/updatenotification/lib/Controller/APIController.php +++ b/apps/updatenotification/lib/Controller/APIController.php @@ -78,7 +78,7 @@ class APIController extends OCSController { // Get list of installed custom apps $installedApps = $this->appManager->getInstalledApps(); - $installedApps = array_filter($installedApps, function($app) { + $installedApps = array_filter($installedApps, function ($app) { try { $this->appManager->getAppPath($app); } catch (AppPathNotFoundException $e) { @@ -97,7 +97,7 @@ class APIController extends OCSController { $this->appFetcher->setVersion($newVersion, 'future-apps.json', false); // Apps available on the app store for that version - $availableApps = array_map(function(array $app) { + $availableApps = array_map(function (array $app) { return $app['id']; }, $this->appFetcher->get()); diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 2971bcfc3f8..3cbae3f4743 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -27,10 +27,10 @@ * */ -\OC::$server->registerService('LDAPUserPluginManager', function() { +\OC::$server->registerService('LDAPUserPluginManager', function () { return new OCA\User_LDAP\UserPluginManager(); }); -\OC::$server->registerService('LDAPGroupPluginManager', function() { +\OC::$server->registerService('LDAPGroupPluginManager', function () { return new OCA\User_LDAP\GroupPluginManager(); }); diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index e23aa6b4549..81e467cb639 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -919,7 +919,7 @@ class Access extends LDAPUtility { if(!$forceApplyAttributes) { $isBackgroundJobModeAjax = $this->config ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; - $recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax) { + $recordsToUpdate = array_filter($ldapRecords, function ($record) use ($isBackgroundJobModeAjax) { $newlyMapped = false; $uid = $this->dn2ocname($record['dn'][0], null, true, $newlyMapped, $record); if(is_string($uid)) { @@ -940,7 +940,7 @@ class Access extends LDAPUtility { * @param array $ldapRecords * @throws \Exception */ - public function batchApplyUserAttributes(array $ldapRecords){ + public function batchApplyUserAttributes(array $ldapRecords) { $displayNameAttribute = strtolower($this->connection->ldapUserDisplayName); foreach($ldapRecords as $userRecord) { if(!isset($userRecord[$displayNameAttribute])) { @@ -973,7 +973,7 @@ class Access extends LDAPUtility { */ public function fetchListOfGroups($filter, $attr, $limit = null, $offset = null) { $groupRecords = $this->searchGroups($filter, $attr, $limit, $offset); - array_walk($groupRecords, function($record) { + array_walk($groupRecords, function ($record) { $newlyMapped = false; $gid = $this->dn2ocname($record['dn'][0], null, false, $newlyMapped, $record); if(!$newlyMapped && is_string($gid)) { @@ -993,7 +993,7 @@ class Access extends LDAPUtility { if($manyAttributes) { return $list; } else { - $list = array_reduce($list, function($carry, $item) { + $list = array_reduce($list, function ($carry, $item) { $attribute = array_keys($item)[0]; $carry[] = $item[$attribute][0]; return $carry; diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 8e2ed30c396..ae8114d1705 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -35,14 +35,14 @@ use OCP\AppFramework\IAppContainer; use OCP\IL10N; class Application extends App { - public function __construct () { + public function __construct() { parent::__construct('user_ldap'); $container = $this->getContainer(); /** * Controller */ - $container->registerService('RenewPasswordController', function(IAppContainer $c) { + $container->registerService('RenewPasswordController', function (IAppContainer $c) { /** @var \OC\Server $server */ $server = $c->query('ServerContainer'); @@ -67,7 +67,7 @@ class Application extends App { $container->getServer()->getEventDispatcher()->addListener( 'OCA\\Files_External::loadAdditionalBackends', - function() use ($container) { + function () use ($container) { $storagesBackendService = $container->query(BackendService::class); $storagesBackendService->registerConfigHandler('home', function () use ($container) { return $container->query(ExtStorageConfigHandler::class); diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index a55a285dde3..c166ad5ebef 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -236,7 +236,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD $seen[$dnGroup] = 1; $members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr); if (is_array($members)) { - $fetcher = function($memberDN, &$seen) { + $fetcher = function ($memberDN, &$seen) { return $this->_groupMembers($memberDN, $seen); }; $allMembers = $this->walkNestedGroups($dnGroup, $fetcher, $members); @@ -260,7 +260,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD return []; } - $fetcher = function($groupDN) { + $fetcher = function ($groupDN) { if (isset($this->cachedNestedGroups[$groupDN])) { $nestedGroups = $this->cachedNestedGroups[$groupDN]; } else { diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index 02b50c83a66..e095ba41bef 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -103,7 +103,7 @@ class Sync extends TimedJob { */ protected function getMinPagingSize() { $configKeys = $this->config->getAppKeys('user_ldap'); - $configKeys = array_filter($configKeys, function($key) { + $configKeys = array_filter($configKeys, function ($key) { return strpos($key, 'ldap_paging_size') !== false; }); $minPagingSize = null; diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index 35edaccc6a0..71a2ea8c69e 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -50,14 +50,14 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob { static private $groupBE; - public function __construct(){ + public function __construct() { $this->interval = self::getRefreshInterval(); } /** * @param mixed $argument */ - public function run($argument){ + public function run($argument) { self::updateGroups(); } diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index 7b6b5206202..f346272a18b 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -194,7 +194,7 @@ class LDAP implements ILDAPWrapper { * @throws \Exception */ public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { - $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { + $oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) { if(strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { return true; } diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index d4d389ff760..3f3e8cd3be3 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -195,7 +195,7 @@ class Manager { } $attributes = array_reduce($attributes, - function($list, $attribute) { + function ($list, $attribute) { $attribute = strtolower(trim((string)$attribute)); if(!empty($attribute) && !in_array($attribute, $list)) { $list[] = $attribute; diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 917a2aaf84c..08b0464cc50 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -571,7 +571,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn * Backend name to be shown in user management * @return string the name of the backend to be shown */ - public function getBackendName(){ + public function getBackendName() { return 'LDAP'; } diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 71000cf88c5..839578cd606 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -79,7 +79,7 @@ class Wizard extends LDAPUtility { $this->result = new WizardResult(); } - public function __destruct() { + public function __destruct() { if($this->result->hasChanges()) { $this->configuration->saveConfiguration(); } diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 35d38b24920..a805f387086 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -538,7 +538,7 @@ class AccessTest extends TestCase { ->willReturn($fakeConnection); $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($key) use ($base) { + ->willReturnCallback(function ($key) use ($base) { if(stripos($key, 'base') !== false) { return $base; } @@ -616,7 +616,7 @@ class AccessTest extends TestCase { ]; $expected = $fakeLdapEntries; unset($expected['count']); - array_walk($expected, function(&$v) { + array_walk($expected, function (&$v) { $v['dn'] = [$v['dn']]; // dn is translated into an array internally for consistency }); @@ -628,7 +628,7 @@ class AccessTest extends TestCase { $this->userMapper->expects($this->exactly($fakeLdapEntries['count'])) ->method('getNameByDN') - ->willReturnCallback(function($fdn) { + ->willReturnCallback(function ($fdn) { $parts = ldap_explode_dn($fdn, false); return $parts[0]; }); diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index fb5840f0ddb..a81255c10a9 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -88,7 +88,7 @@ class Group_LDAPTest extends TestCase { $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapDynamicGroupMemberURL') { return ''; } @@ -109,7 +109,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn) use ($groupDN) { + ->willReturnCallback(function ($dn) use ($groupDN) { if($dn === $groupDN) { return [ 'uid=u11,ou=users,dc=foo,dc=bar', @@ -148,7 +148,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { //the search operation will call readAttribute, thus we need //to anaylze the "dn". All other times we just need to return //something that is neither null or false, but once an array @@ -162,7 +162,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('dn2username') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return 'foobar' . \OC::$server->getSecureRandom()->generate(7); }); @@ -520,7 +520,7 @@ class Group_LDAPTest extends TestCase { ->willReturn(null); $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; } else if($attr === 'gidNumber') { @@ -557,7 +557,7 @@ class Group_LDAPTest extends TestCase { ->willReturn(null); $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; } @@ -593,7 +593,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; } @@ -654,7 +654,7 @@ class Group_LDAPTest extends TestCase { $access->connection = $this->createMock(Connection::class); $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'useMemberOfToDetectMembership') { return 0; } else if($name === 'ldapDynamicGroupMemberURL') { @@ -692,7 +692,7 @@ class Group_LDAPTest extends TestCase { $access->connection = $this->createMock(Connection::class); $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { switch($name) { case 'useMemberOfToDetectMembership': return 0; @@ -1030,7 +1030,7 @@ class Group_LDAPTest extends TestCase { $access = $this->getAccessMock(); $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($group) use ($groupDN, $expectedMembers, $groupsInfo) { + ->willReturnCallback(function ($group) use ($groupDN, $expectedMembers, $groupsInfo) { if(isset($groupsInfo[$group])) { return $groupsInfo[$group]; } @@ -1041,7 +1041,7 @@ class Group_LDAPTest extends TestCase { if(count($groupsInfo) > 1) { $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapNestedGroups') { return 1; } @@ -1079,7 +1079,7 @@ class Group_LDAPTest extends TestCase { $access->connection = $this->createMock(Connection::class); $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapGroupMemberAssocAttr') { return 'member'; } else if($name === 'ldapGroupFilter') { diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php index a803e5d284a..5aace2c5c91 100644 --- a/apps/user_ldap/tests/HelperTest.php +++ b/apps/user_ldap/tests/HelperTest.php @@ -67,7 +67,7 @@ class HelperTest extends \Test\TestCase { ]); $this->config->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) { + ->willReturnCallback(function ($app, $key, $default) { if ($app !== 'user_ldap') { $this->fail('wrong app'); } @@ -93,7 +93,7 @@ class HelperTest extends \Test\TestCase { ]); $this->config->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) { + ->willReturnCallback(function ($app, $key, $default) { if ($app !== 'user_ldap') { $this->fail('wrong app'); } diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php index a3c4dd364fe..77aeddf94f5 100644 --- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php +++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php @@ -71,10 +71,10 @@ abstract class AbstractIntegrationTest { * the LDAP backend. */ public function init() { - \OC::$server->registerService('LDAPUserPluginManager', function() { + \OC::$server->registerService('LDAPUserPluginManager', function () { return new \OCA\User_LDAP\UserPluginManager(); }); - \OC::$server->registerService('LDAPGroupPluginManager', function() { + \OC::$server->registerService('LDAPGroupPluginManager', function () { return new \OCA\User_LDAP\GroupPluginManager(); }); diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index 8cab95fc801..1cdbefb289c 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -128,7 +128,7 @@ class SyncTest extends TestCase { $this->config->expects($this->once()) ->method('setAppValue') ->with('user_ldap', 'background_sync_interval', $this->anything()) - ->willReturnCallback(function($a, $k, $interval) { + ->willReturnCallback(function ($a, $k, $interval) { $this->assertTrue($interval >= SYNC::MIN_INTERVAL); $this->assertTrue($interval <= SYNC::MAX_INTERVAL); return true; @@ -294,7 +294,7 @@ class SyncTest extends TestCase { public function testRun($runData) { $this->config->expects($this->any()) ->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) use ($runData) { + ->willReturnCallback(function ($app, $key, $default) use ($runData) { if($app === 'core' && $key === 'backgroundjobs_mode') { return 'cron'; } diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php index 56ee04906b7..8dd7122b4e1 100644 --- a/apps/user_ldap/tests/LDAPTest.php +++ b/apps/user_ldap/tests/LDAPTest.php @@ -60,7 +60,7 @@ class LDAPTest extends TestCase { public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough) { $wasErrorHandlerCalled = false; - $errorHandler = function($number, $message, $file, $line) use (&$wasErrorHandlerCalled) { + $errorHandler = function ($number, $message, $file, $line) use (&$wasErrorHandlerCalled) { $wasErrorHandlerCalled = true; }; @@ -70,7 +70,7 @@ class LDAPTest extends TestCase { ->expects($this->once()) ->method('invokeLDAPMethod') ->with('search', $this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything()) - ->willReturnCallback(function() use($errorMessage) { + ->willReturnCallback(function () use ($errorMessage) { trigger_error($errorMessage); }); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 4e8dacaeda1..7453b31e338 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -606,7 +606,7 @@ class UserTest extends \Test\TestCase { public function XtestUpdateAvatarThumbnailPhotoProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegphoto') { @@ -671,7 +671,7 @@ class UserTest extends \Test\TestCase { public function testUpdateAvatarCorruptPhotoProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegphoto') { @@ -724,7 +724,7 @@ class UserTest extends \Test\TestCase { public function XtestUpdateAvatarUnsupportedThumbnailPhotoProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegphoto') { @@ -789,7 +789,7 @@ class UserTest extends \Test\TestCase { public function testUpdateAvatarNotProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegPhoto') { @@ -1038,7 +1038,7 @@ class UserTest extends \Test\TestCase { ]); $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:homeDirectory'; } @@ -1193,7 +1193,7 @@ class UserTest extends \Test\TestCase { public function testHandlePasswordExpiryWarningDefaultPolicy() { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapDefaultPPolicyDN') { return 'cn=default,ou=policies,dc=foo,dc=bar'; } @@ -1205,7 +1205,7 @@ class UserTest extends \Test\TestCase { $this->access->expects($this->any()) ->method('search') - ->willReturnCallback(function($filter, $base) { + ->willReturnCallback(function ($filter, $base) { if($base === [$this->dn]) { return [ [ @@ -1256,7 +1256,7 @@ class UserTest extends \Test\TestCase { public function testHandlePasswordExpiryWarningCustomPolicy() { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapDefaultPPolicyDN') { return 'cn=default,ou=policies,dc=foo,dc=bar'; } @@ -1268,7 +1268,7 @@ class UserTest extends \Test\TestCase { $this->access->expects($this->any()) ->method('search') - ->willReturnCallback(function($filter, $base) { + ->willReturnCallback(function ($filter, $base) { if($base === [$this->dn]) { return [ [ diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 3f0259692ac..8dc699f371b 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -108,7 +108,7 @@ class User_LDAPTest extends TestCase { private function prepareMockForUserExists() { $this->access->expects($this->any()) ->method('username2dn') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch ($uid) { case 'gunslinger': return 'dnOfRoland,dc=test'; @@ -139,7 +139,7 @@ class User_LDAPTest extends TestCase { private function prepareAccessForCheckPassword($noDisplayName = false) { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapLoginFilter') { return '%uid'; } @@ -148,7 +148,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('fetchListOfUsers') - ->willReturnCallback(function($filter) { + ->willReturnCallback(function ($filter) { if($filter === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -156,7 +156,7 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if($uid === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -177,7 +177,7 @@ class User_LDAPTest extends TestCase { ->willReturn(true); $this->access->expects($this->any()) ->method('areCredentialsValid') - ->willReturnCallback(function($dn, $pwd) { + ->willReturnCallback(function ($dn, $pwd) { if($pwd === 'dt19') { return true; } @@ -363,22 +363,22 @@ class User_LDAPTest extends TestCase { private function prepareAccessForGetUsers() { $this->access->expects($this->once()) ->method('escapeFilterPart') - ->willReturnCallback(function($search) { + ->willReturnCallback(function ($search) { return $search; }); $this->access->expects($this->any()) ->method('getFilterPartForUserSearch') - ->willReturnCallback(function($search) { + ->willReturnCallback(function ($search) { return $search; }); $this->access->expects($this->any()) ->method('combineFilterWithAnd') - ->willReturnCallback(function($param) { + ->willReturnCallback(function ($param) { return $param[2]; }); $this->access->expects($this->any()) ->method('fetchListOfUsers') - ->willReturnCallback(function($search, $a, $l, $o) { + ->willReturnCallback(function ($search, $a, $l, $o) { $users = ['gunslinger', 'newyorker', 'ladyofshadows']; if(empty($search)) { $result = $users; @@ -444,7 +444,7 @@ class User_LDAPTest extends TestCase { private function getUsers($search = '', $limit = null, $offset = null) { $users = \OC::$server->getUserManager()->search($search, $limit, $offset); - $uids = array_map(function(IUser $user) { + $uids = array_map(function (IUser $user) { return $user->getUID(); }, $users); return $uids; @@ -544,7 +544,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn) { + ->willReturnCallback(function ($dn) { if($dn === 'dnOfRoland,dc=test') { return []; } @@ -569,7 +569,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn) { + ->willReturnCallback(function ($dn) { if($dn === 'dnOfRoland,dc=test') { return []; } @@ -601,7 +601,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -610,7 +610,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { case 'dnOfRoland,dc=test': if($attr === 'testAttribute') { @@ -653,7 +653,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -662,7 +662,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { case 'dnOfLadyOfShadows,dc=test': if($attr === 'testAttribute') { @@ -704,7 +704,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -712,7 +712,7 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { default: return false; @@ -720,7 +720,7 @@ class User_LDAPTest extends TestCase { }); $this->access->connection->expects($this->any()) ->method('getFromCache') - ->willReturnCallback(function($key) { + ->willReturnCallback(function ($key) { if($key === 'userExistsnewyorker') { return true; } @@ -752,7 +752,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -798,7 +798,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getFromCache') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { return true; }); @@ -809,7 +809,7 @@ class User_LDAPTest extends TestCase { private function prepareAccessForGetDisplayName() { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapUserDisplayName') { return 'displayname'; } @@ -818,7 +818,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { case 'dnOfRoland,dc=test': if($attr === 'displayname') { @@ -842,7 +842,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getConnectionResource') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return true; }); @@ -864,11 +864,11 @@ class User_LDAPTest extends TestCase { $mapper = $this->createMock(UserMapping::class); $mapper->expects($this->any()) ->method('getUUIDByDN') - ->willReturnCallback(function($dn) { return $dn; }); + ->willReturnCallback(function ($dn) { return $dn; }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) use ($user1, $user2) { + ->willReturnCallback(function ($uid) use ($user1, $user2) { if($uid === 'gunslinger') { return $user1; } else if($uid === 'newyorker') { @@ -881,7 +881,7 @@ class User_LDAPTest extends TestCase { ->willReturn($mapper); $this->access->expects($this->any()) ->method('getUserDnByUuid') - ->willReturnCallback(function($uuid) { return $uuid . '1'; }); + ->willReturnCallback(function ($uuid) { return $uuid . '1'; }); //with displayName $result = $backend->getDisplayName('gunslinger'); @@ -895,7 +895,7 @@ class User_LDAPTest extends TestCase { public function testGetDisplayNamePublicAPI() { $this->access->expects($this->any()) ->method('username2dn') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch ($uid) { case 'gunslinger': return 'dnOfRoland,dc=test'; @@ -919,7 +919,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getConnectionResource') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return true; }); @@ -943,11 +943,11 @@ class User_LDAPTest extends TestCase { $mapper = $this->createMock(UserMapping::class); $mapper->expects($this->any()) ->method('getUUIDByDN') - ->willReturnCallback(function($dn) { return $dn; }); + ->willReturnCallback(function ($dn) { return $dn; }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) use ($user1, $user2) { + ->willReturnCallback(function ($uid) use ($user1, $user2) { if($uid === 'gunslinger') { return $user1; } else if($uid === 'newyorker') { @@ -960,7 +960,7 @@ class User_LDAPTest extends TestCase { ->willReturn($mapper); $this->access->expects($this->any()) ->method('getUserDnByUuid') - ->willReturnCallback(function($uuid) { return $uuid . '1'; }); + ->willReturnCallback(function ($uuid) { return $uuid . '1'; }); //with displayName $result = \OC::$server->getUserManager()->get('gunslinger')->getDisplayName(); @@ -1135,7 +1135,7 @@ class User_LDAPTest extends TestCase { private function prepareAccessForSetPassword($enablePasswordChange = true) { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) use (&$enablePasswordChange) { + ->willReturnCallback(function ($name) use (&$enablePasswordChange) { if($name === 'ldapLoginFilter') { return '%uid'; } @@ -1146,7 +1146,7 @@ class User_LDAPTest extends TestCase { }); $this->connection->expects($this->any()) ->method('getFromCache') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if($uid === 'userExists'.'roland') { return true; } @@ -1155,7 +1155,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('fetchListOfUsers') - ->willReturnCallback(function($filter) { + ->willReturnCallback(function ($filter) { if($filter === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -1163,7 +1163,7 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if($uid === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -1179,7 +1179,7 @@ class User_LDAPTest extends TestCase { ->willReturn(true); $this->access->expects($this->any()) ->method('setPassword') - ->willReturnCallback(function($uid, $password) { + ->willReturnCallback(function ($uid, $password) { if(strlen($password) <= 5) { throw new HintException('Password fails quality checking policy', '', 19); } diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index d3a988a06b7..0a94eb2a1f4 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -103,7 +103,7 @@ class WizardTest extends TestCase { $configuration->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapBase') { return ['base']; } @@ -147,7 +147,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(10)) ->method('getDN') //dummy value, usually invalid - ->willReturnCallback(function($a, $b) { + ->willReturnCallback(function ($a, $b) { global $uidnumber; return $uidnumber++; }); @@ -163,7 +163,7 @@ class WizardTest extends TestCase { $configuration->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapBase') { return ['base']; } @@ -174,7 +174,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('isResource') - ->willReturnCallback(function($r) { + ->willReturnCallback(function ($r) { if($r === true) { return true; } @@ -200,7 +200,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(2)) ->method('firstEntry') //dummy value, usually invalid - ->willReturnCallback(function($r) { + ->willReturnCallback(function ($r) { global $uidnumber; return $uidnumber; }); @@ -208,7 +208,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(46)) ->method('nextEntry') //dummy value, usually invalid - ->willReturnCallback(function($r) { + ->willReturnCallback(function ($r) { global $uidnumber; return $uidnumber; }); @@ -223,7 +223,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(46)) ->method('getDN') //dummy value, usually invalid - ->willReturnCallback(function($a, $b) { + ->willReturnCallback(function ($a, $b) { global $uidnumber; return $uidnumber++; }); @@ -379,7 +379,7 @@ class WizardTest extends TestCase { $configuration->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapBase') { return ['base']; } @@ -390,7 +390,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('isResource') - ->willReturnCallback(function($res) { + ->willReturnCallback(function ($res) { return (bool)$res; }); @@ -416,7 +416,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('nextEntry') //dummy value, usually invalid - ->willReturnCallback(function($a, $prev){ + ->willReturnCallback(function ($a, $prev) { $current = $prev + 1; if($current === 7) { return false; @@ -432,14 +432,14 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('getAttributes') //dummy value, usually invalid - ->willReturnCallback(function($a, $entry) { + ->willReturnCallback(function ($a, $entry) { return ['cn' => [$entry], 'count' => 1]; }); $ldap->expects($this->any()) ->method('getDN') //dummy value, usually invalid - ->willReturnCallback(function($a, $b) { + ->willReturnCallback(function ($a, $b) { return $b; }); diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php index 4b294678fbd..e0de77a852b 100644 --- a/apps/workflowengine/lib/Check/AbstractStringCheck.php +++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php @@ -50,7 +50,7 @@ abstract class AbstractStringCheck implements ICheck { * @param string $value * @return bool */ - public function executeCheck($operator, $value) { + public function executeCheck($operator, $value) { $actualValue = $this->getActualValue(); return $this->executeStringCheck($operator, $value, $actualValue); } diff --git a/apps/workflowengine/lib/Check/RequestURL.php b/apps/workflowengine/lib/Check/RequestURL.php index 4c933c19ace..30424a1ee47 100644 --- a/apps/workflowengine/lib/Check/RequestURL.php +++ b/apps/workflowengine/lib/Check/RequestURL.php @@ -46,7 +46,7 @@ class RequestURL extends AbstractStringCheck { * @param string $value * @return bool */ - public function executeCheck($operator, $value) { + public function executeCheck($operator, $value) { $actualValue = $this->getActualValue(); if (in_array($operator, ['is', '!is'])) { switch ($value) { diff --git a/apps/workflowengine/lib/Settings/ASettings.php b/apps/workflowengine/lib/Settings/ASettings.php index 2bf7dd0218e..b2db7d12364 100644 --- a/apps/workflowengine/lib/Settings/ASettings.php +++ b/apps/workflowengine/lib/Settings/ASettings.php @@ -147,7 +147,7 @@ abstract class ASettings implements ISettings { private function entitiesToArray(array $entities) { return array_map(function (IEntity $entity) { - $events = array_map(function(IEntityEvent $entityEvent) { + $events = array_map(function (IEntityEvent $entityEvent) { return [ 'eventName' => $entityEvent->getEventName(), 'displayName' => $entityEvent->getDisplayName() @@ -164,7 +164,7 @@ abstract class ASettings implements ISettings { } private function operatorsToArray(array $operators) { - $operators = array_filter($operators, function(IOperation $operator) { + $operators = array_filter($operators, function (IOperation $operator) { return $operator->isAvailableForScope($this->getScope()); }); @@ -182,7 +182,7 @@ abstract class ASettings implements ISettings { } private function checksToArray(array $checks) { - $checks = array_filter($checks, function(ICheck $check) { + $checks = array_filter($checks, function (ICheck $check) { return $check->isAvailableForScope($this->getScope()); }); diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php index 70f8f79146a..f9fc57a5331 100644 --- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php +++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php @@ -31,7 +31,7 @@ class AbstractStringCheckTest extends \Test\TestCase { ->getMock(); $l->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return sprintf($string, $args); }); diff --git a/apps/workflowengine/tests/Check/RequestUserAgentTest.php b/apps/workflowengine/tests/Check/RequestUserAgentTest.php index 7003441053d..7ea5aad2a6e 100644 --- a/apps/workflowengine/tests/Check/RequestUserAgentTest.php +++ b/apps/workflowengine/tests/Check/RequestUserAgentTest.php @@ -44,7 +44,7 @@ class RequestUserAgentTest extends TestCase { ->getMock(); $l->expects($this->any()) ->method('t') - ->willReturnCallback(function($string, $args) { + ->willReturnCallback(function ($string, $args) { return sprintf($string, $args); }); diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php index 2a5128f76b6..cad4be174cf 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -78,7 +78,7 @@ class ManagerTest extends TestCase { /** @var IL10N|MockObject $l */ $this->l = $this->createMock(IL10N::class); $this->l->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); @@ -414,7 +414,7 @@ class ManagerTest extends TestCase { $this->legacyDispatcher->expects($this->once()) ->method('dispatch') ->with('OCP\WorkflowEngine::registerEntities', $this->anything()) - ->willReturnCallback(function() use ($extraEntity) { + ->willReturnCallback(function () use ($extraEntity) { $this->manager->registerEntity($extraEntity); }); |