From caff1023ea72bb2ea94130e18a2a6e2ccf819e5f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 14:19:56 +0200 Subject: Format control structures, classes, methods and function To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst --- apps/updatenotification/lib/Notification/BackgroundJob.php | 1 - apps/updatenotification/lib/ResetTokenBackgroundJob.php | 3 +-- apps/updatenotification/lib/Settings/Admin.php | 8 ++++---- apps/updatenotification/tests/Controller/AdminControllerTest.php | 1 - apps/updatenotification/tests/Notification/BackgroundJobTest.php | 3 ++- apps/updatenotification/tests/Notification/NotifierTest.php | 3 ++- 6 files changed, 9 insertions(+), 10 deletions(-) (limited to 'apps/updatenotification') diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php index d352375163f..b32ec024a16 100644 --- a/apps/updatenotification/lib/Notification/BackgroundJob.php +++ b/apps/updatenotification/lib/Notification/BackgroundJob.php @@ -37,7 +37,6 @@ use OCP\IGroupManager; use OCP\Notification\IManager; class BackgroundJob extends TimedJob { - protected $connectionNotifications = [3, 7, 14, 30]; /** @var IConfig */ diff --git a/apps/updatenotification/lib/ResetTokenBackgroundJob.php b/apps/updatenotification/lib/ResetTokenBackgroundJob.php index 9bd414d1e5c..d64a26c62e8 100644 --- a/apps/updatenotification/lib/ResetTokenBackgroundJob.php +++ b/apps/updatenotification/lib/ResetTokenBackgroundJob.php @@ -59,9 +59,8 @@ class ResetTokenBackgroundJob extends TimedJob { */ protected function run($argument) { // Delete old tokens after 2 days - if($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) { + if ($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) { $this->config->deleteSystemValue('updater.secret'); } } - } diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php index db2efffc46b..f623e69e02e 100644 --- a/apps/updatenotification/lib/Settings/Admin.php +++ b/apps/updatenotification/lib/Settings/Admin.php @@ -126,22 +126,22 @@ class Admin implements ISettings { protected function filterChanges(array $changes): array { $filtered = []; - if(isset($changes['changelogURL'])) { + if (isset($changes['changelogURL'])) { $filtered['changelogURL'] = $changes['changelogURL']; } - if(!isset($changes['whatsNew'])) { + if (!isset($changes['whatsNew'])) { return $filtered; } $iterator = $this->l10nFactory->getLanguageIterator(); do { $lang = $iterator->current(); - if(isset($changes['whatsNew'][$lang])) { + if (isset($changes['whatsNew'][$lang])) { $filtered['whatsNew'] = $changes['whatsNew'][$lang]; return $filtered; } $iterator->next(); - } while($lang !== 'en' && $iterator->valid()); + } while ($lang !== 'en' && $iterator->valid()); return $filtered; } diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php index 597b646ee6b..e40364cce09 100644 --- a/apps/updatenotification/tests/Controller/AdminControllerTest.php +++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php @@ -101,5 +101,4 @@ class AdminControllerTest extends TestCase { $expected = new DataResponse('MyGeneratedToken'); $this->assertEquals($expected, $this->adminController->createCredentials()); } - } diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php index 04b0260811e..92f7bc2a8aa 100644 --- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php +++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php @@ -80,7 +80,8 @@ class BackgroundJobTest extends TestCase { $this->client, $this->installer ); - } { + } + { return $this->getMockBuilder(BackgroundJob::class) ->setConstructorArgs([ $this->config, diff --git a/apps/updatenotification/tests/Notification/NotifierTest.php b/apps/updatenotification/tests/Notification/NotifierTest.php index 6c36a8a74aa..e071fb06b23 100644 --- a/apps/updatenotification/tests/Notification/NotifierTest.php +++ b/apps/updatenotification/tests/Notification/NotifierTest.php @@ -77,7 +77,8 @@ class NotifierTest extends TestCase { $this->userSession, $this->groupManager ); - } { + } + { return $this->getMockBuilder(Notifier::class) ->setConstructorArgs([ $this->urlGenerator, -- cgit v1.2.3