From 6c6fbd70e032d5df91a4d4553a971dfd102d678d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 1 Oct 2024 12:41:55 +0200 Subject: [PATCH 1/8] ci: Add rector Signed-off-by: Joas Schilling --- composer.json | 2 + rector.php | 19 +++ vendor-bin/rector/composer.json | 12 ++ vendor-bin/rector/composer.lock | 201 ++++++++++++++++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 rector.php create mode 100644 vendor-bin/rector/composer.json create mode 100644 vendor-bin/rector/composer.lock diff --git a/composer.json b/composer.json index 2d954bdf..85943a6b 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,8 @@ "psalm:update-baseline": "psalm --threads=1 --update-baseline", "psalm:clear": "psalm --clear-cache && psalm --clear-global-cache", "psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", + "rector:check": "rector --dry-run --clear-cache", + "rector:fix": "rector", "test:unit": "phpunit --color -c tests/Unit/phpunit.xml", "test:integration": "cd tests/Integration && ./run.sh" } diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..d4d3cdc8 --- /dev/null +++ b/rector.php @@ -0,0 +1,19 @@ +withPaths([ + __DIR__ . '/appinfo', + __DIR__ . '/lib', + __DIR__ . '/templates', + __DIR__ . '/tests/Integration', + __DIR__ . '/tests/Unit', + ]) + ->withPhpSets(php74: true) + ->withTypeCoverageLevel(0); diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json new file mode 100644 index 00000000..fdfdc4eb --- /dev/null +++ b/vendor-bin/rector/composer.json @@ -0,0 +1,12 @@ +{ + "config": { + "platform": { + "php": "8.1" + }, + "sort-packages": true + }, + "require-dev": { + "nextcloud/rector": "^0.2", + "rector/rector": "^1.2" + } +} diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock new file mode 100644 index 00000000..26a39741 --- /dev/null +++ b/vendor-bin/rector/composer.lock @@ -0,0 +1,201 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "711b750aba0eaea5b584c053d710aba2", + "packages": [], + "packages-dev": [ + { + "name": "nextcloud/rector", + "version": "v0.2.0", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-libraries/rector.git", + "reference": "c5cceb7faf2d4df61fe1fd8f82e19c7b106dbe00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-libraries/rector/zipball/c5cceb7faf2d4df61fe1fd8f82e19c7b106dbe00", + "reference": "c5cceb7faf2d4df61fe1fd8f82e19c7b106dbe00", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.5", + "ramsey/devtools": "^2.0", + "rector/rector": "^1.2" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + }, + "ramsey/devtools": { + "command-prefix": "dev", + "memory-limit": "-1" + } + }, + "autoload": { + "psr-4": { + "Nextcloud\\Rector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at", + "homepage": "https://wuc.me" + } + ], + "description": "Rector upgrade rules for Nextcloud", + "keywords": [ + "nextcloud", + "refactoring" + ], + "support": { + "issues": "https://github.com/nextcloud-libraries/rector/issues", + "source": "https://github.com/nextcloud-libraries/rector/tree/v0.2.0" + }, + "time": "2024-09-19T09:54:28+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.12.5", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-09-26T12:45:22+00:00" + }, + { + "name": "rector/rector", + "version": "1.2.5", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e98aa793ca3fcd17e893cfaf9103ac049775d339", + "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.12.2" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/1.2.5" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2024-09-08T17:43:24+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "platform-overrides": { + "php": "8.1" + }, + "plugin-api-version": "2.6.0" +} From e037d2bae3000a591605192879b0e5dae51aa486 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 1 Oct 2024 12:42:28 +0200 Subject: [PATCH 2/8] fix(rector): Apply autofixes until PHP 7.4 Signed-off-by: Joas Schilling --- lib/BackgroundJob/GenerateUserSettings.php | 2 +- lib/MailNotifications.php | 4 +--- lib/Push.php | 8 ++------ tests/Integration/features/bootstrap/CommandLineTrait.php | 4 +--- tests/Unit/HandlerTest.php | 3 +-- tests/Unit/Notifier/NotifierTest.php | 4 +--- 6 files changed, 7 insertions(+), 18 deletions(-) diff --git a/lib/BackgroundJob/GenerateUserSettings.php b/lib/BackgroundJob/GenerateUserSettings.php index 9fe29fc3..4d90fa9d 100644 --- a/lib/BackgroundJob/GenerateUserSettings.php +++ b/lib/BackgroundJob/GenerateUserSettings.php @@ -52,7 +52,7 @@ protected function run($argument): void { $maxId = (int)$result->fetchOne(); $result->closeCursor(); - $this->userManager->callForSeenUsers(function (IUser $user) use ($maxId) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($maxId): void { if ($user->isEnabled()) { return; } diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index cf67369b..745b9580 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -110,9 +110,7 @@ public function sendEmails(int $batchSize, int $sendTime): void { return; } - $userIds = array_map(static function (Settings $settings) { - return $settings->getUserId(); - }, $userSettings); + $userIds = array_map(static fn(Settings $settings) => $settings->getUserId(), $userSettings); // Batch-read settings $fallbackTimeZone = date_default_timezone_get(); diff --git a/lib/Push.php b/lib/Push.php index bac335ee..146a5391 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -207,12 +207,8 @@ public function flushPayloads(): void { public function filterDeviceList(array $devices, string $app): array { $isTalkNotification = \in_array($app, ['spreed', 'talk', 'admin_notification_talk'], true); - $talkDevices = array_filter($devices, static function ($device) { - return $device['apptype'] === 'talk'; - }); - $otherDevices = array_filter($devices, static function ($device) { - return $device['apptype'] !== 'talk'; - }); + $talkDevices = array_filter($devices, static fn($device) => $device['apptype'] === 'talk'); + $otherDevices = array_filter($devices, static fn($device) => $device['apptype'] !== 'talk'); $this->printInfo('Identified ' . count($talkDevices) . ' Talk devices and ' . count($otherDevices) . ' others.'); diff --git a/tests/Integration/features/bootstrap/CommandLineTrait.php b/tests/Integration/features/bootstrap/CommandLineTrait.php index bdab39e5..600f96e8 100644 --- a/tests/Integration/features/bootstrap/CommandLineTrait.php +++ b/tests/Integration/features/bootstrap/CommandLineTrait.php @@ -42,9 +42,7 @@ public function runOcc($args = [], $env = []) { 'maintenance:mode', ], true); - $args = array_map(function ($arg) { - return escapeshellarg($arg); - }, $args); + $args = array_map(fn($arg) => escapeshellarg($arg), $args); $args[] = '--no-ansi'; $argString = implode(' ', $args); diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php index d6ed3cfd..5b3741a3 100644 --- a/tests/Unit/HandlerTest.php +++ b/tests/Unit/HandlerTest.php @@ -186,8 +186,7 @@ public function testDeleteById() { // Get and count $notifications = $this->handler->get($limitedNotification); $this->assertCount(1, $notifications); - reset($notifications); - $notificationId = key($notifications); + $notificationId = array_key_first($notifications); // Get with wrong user try { diff --git a/tests/Unit/Notifier/NotifierTest.php b/tests/Unit/Notifier/NotifierTest.php index 8ce6cb46..d058062b 100644 --- a/tests/Unit/Notifier/NotifierTest.php +++ b/tests/Unit/Notifier/NotifierTest.php @@ -31,9 +31,7 @@ protected function setUp(): void { $this->l = $this->createMock(IL10N::class); $this->l->expects($this->any()) ->method('t') - ->willReturnCallback(function ($string, $args) { - return vsprintf($string, $args); - }); + ->willReturnCallback(fn($string, $args) => vsprintf($string, $args)); $this->factory = $this->createMock(IFactory::class); $this->factory->expects($this->any()) ->method('get') From 8859e5672e49fd51842ec083341c48723c87cb56 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 2 Oct 2024 07:44:47 +0200 Subject: [PATCH 3/8] tests: Remove empty abstract class Signed-off-by: Joas Schilling --- tests/Unit/AppInfo/ApplicationTest.php | 2 +- tests/Unit/AppInfo/RoutesTest.php | 2 +- tests/Unit/AppTest.php | 1 + tests/Unit/CapabilitiesTest.php | 1 + tests/Unit/Command/GenerateTest.php | 3 ++- tests/Unit/Controller/APIControllerTest.php | 3 ++- tests/Unit/Controller/EndpointControllerTest.php | 2 +- tests/Unit/Controller/PushControllerTest.php | 2 +- tests/Unit/HandlerTest.php | 1 + tests/Unit/Notifier/NotifierTest.php | 3 ++- tests/Unit/PushTest.php | 1 + tests/Unit/TestCase.php | 10 ---------- 12 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 tests/Unit/TestCase.php diff --git a/tests/Unit/AppInfo/ApplicationTest.php b/tests/Unit/AppInfo/ApplicationTest.php index 7c4daea6..1f5fbca0 100644 --- a/tests/Unit/AppInfo/ApplicationTest.php +++ b/tests/Unit/AppInfo/ApplicationTest.php @@ -14,10 +14,10 @@ use OCA\Notifications\Controller\PushController; use OCA\Notifications\Handler; use OCA\Notifications\Push; -use OCA\Notifications\Tests\Unit\TestCase; use OCP\AppFramework\IAppContainer; use OCP\AppFramework\OCSController; use OCP\Notification\IApp; +use Test\TestCase; /** * Class ApplicationTest diff --git a/tests/Unit/AppInfo/RoutesTest.php b/tests/Unit/AppInfo/RoutesTest.php index 06776622..9c4c0df6 100644 --- a/tests/Unit/AppInfo/RoutesTest.php +++ b/tests/Unit/AppInfo/RoutesTest.php @@ -6,7 +6,7 @@ namespace OCA\Notifications\Tests\Unit\AppInfo; -use OCA\Notifications\Tests\Unit\TestCase; +use Test\TestCase; /** * Class RoutesTest diff --git a/tests/Unit/AppTest.php b/tests/Unit/AppTest.php index 04ef2252..3a78f49d 100644 --- a/tests/Unit/AppTest.php +++ b/tests/Unit/AppTest.php @@ -13,6 +13,7 @@ use OCP\Notification\INotification; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; +use Test\TestCase; class AppTest extends TestCase { protected Handler|MockObject $handler; diff --git a/tests/Unit/CapabilitiesTest.php b/tests/Unit/CapabilitiesTest.php index 018769f5..d0e9d352 100644 --- a/tests/Unit/CapabilitiesTest.php +++ b/tests/Unit/CapabilitiesTest.php @@ -8,6 +8,7 @@ namespace OCA\Notifications\Tests\Unit; use OCA\Notifications\Capabilities; +use Test\TestCase; class CapabilitiesTest extends TestCase { public function testGetCapabilities() { diff --git a/tests/Unit/Command/GenerateTest.php b/tests/Unit/Command/GenerateTest.php index fd903692..41f73262 100644 --- a/tests/Unit/Command/GenerateTest.php +++ b/tests/Unit/Command/GenerateTest.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Test\TestCase; /** * Class GenerateTest @@ -24,7 +25,7 @@ * @package OCA\Notifications\Tests\Unit\Command * @group DB */ -class GenerateTest extends \Test\TestCase { +class GenerateTest extends TestCase { /** @var ITimeFactory|MockObject */ protected $timeFactory; /** @var IUserManager|MockObject */ diff --git a/tests/Unit/Controller/APIControllerTest.php b/tests/Unit/Controller/APIControllerTest.php index 0c4a0b4a..e3cb3931 100644 --- a/tests/Unit/Controller/APIControllerTest.php +++ b/tests/Unit/Controller/APIControllerTest.php @@ -20,6 +20,7 @@ use OCP\RichObjectStrings\IValidator; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; +use Test\TestCase; /** * Class APIControllerTest @@ -27,7 +28,7 @@ * @package OCA\Notifications\Tests\Unit\Controller * @group DB */ -class APIControllerTest extends \Test\TestCase { +class APIControllerTest extends TestCase { protected ITimeFactory&MockObject $timeFactory; protected IUserManager&MockObject $userManager; protected IManager&MockObject $notificationManager; diff --git a/tests/Unit/Controller/EndpointControllerTest.php b/tests/Unit/Controller/EndpointControllerTest.php index 0a204227..49097c05 100644 --- a/tests/Unit/Controller/EndpointControllerTest.php +++ b/tests/Unit/Controller/EndpointControllerTest.php @@ -12,7 +12,6 @@ use OCA\Notifications\Handler; use OCA\Notifications\Push; use OCA\Notifications\Service\ClientService; -use OCA\Notifications\Tests\Unit\TestCase; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Utility\ITimeFactory; @@ -25,6 +24,7 @@ use OCP\Notification\INotification; use OCP\UserStatus\IManager as IUserStatusManager; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class EndpointControllerTest extends TestCase { /** @var IRequest|MockObject */ diff --git a/tests/Unit/Controller/PushControllerTest.php b/tests/Unit/Controller/PushControllerTest.php index c4b23c42..b9f9094e 100644 --- a/tests/Unit/Controller/PushControllerTest.php +++ b/tests/Unit/Controller/PushControllerTest.php @@ -12,7 +12,6 @@ use OC\Security\IdentityProof\Key; use OC\Security\IdentityProof\Manager; use OCA\Notifications\Controller\PushController; -use OCA\Notifications\Tests\Unit\TestCase; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IDBConnection; @@ -20,6 +19,7 @@ use OCP\ISession; use OCP\IUser; use OCP\IUserSession; +use Test\TestCase; class PushControllerTest extends TestCase { /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php index 5b3741a3..5c9c2f93 100644 --- a/tests/Unit/HandlerTest.php +++ b/tests/Unit/HandlerTest.php @@ -11,6 +11,7 @@ use OCA\Notifications\Handler; use OCP\Notification\IAction; use OCP\Notification\INotification; +use Test\TestCase; /** * Class HandlerTest diff --git a/tests/Unit/Notifier/NotifierTest.php b/tests/Unit/Notifier/NotifierTest.php index d058062b..266b0406 100644 --- a/tests/Unit/Notifier/NotifierTest.php +++ b/tests/Unit/Notifier/NotifierTest.php @@ -15,8 +15,9 @@ use OCP\Notification\INotification; use OCP\Notification\UnknownNotificationException; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; -class NotifierTest extends \Test\TestCase { +class NotifierTest extends TestCase { protected IFactory|MockObject $factory; protected IURLGenerator|MockObject $urlGenerator; protected IUserManager|MockObject $userManager; diff --git a/tests/Unit/PushTest.php b/tests/Unit/PushTest.php index 6de50ba7..52fac1e2 100644 --- a/tests/Unit/PushTest.php +++ b/tests/Unit/PushTest.php @@ -31,6 +31,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Log\LoggerInterface; +use Test\TestCase; /** * Class PushTest diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php deleted file mode 100644 index e995e3d1..00000000 --- a/tests/Unit/TestCase.php +++ /dev/null @@ -1,10 +0,0 @@ - Date: Wed, 2 Oct 2024 07:47:27 +0200 Subject: [PATCH 4/8] fix(rector): Apply autofixes until PHP 8.1 Signed-off-by: Joas Schilling --- lib/BackgroundJob/GenerateUserSettings.php | 2 +- lib/Command/Generate.php | 2 +- lib/Command/TestPush.php | 2 +- lib/Controller/EndpointController.php | 4 +- lib/Controller/PushController.php | 6 +-- lib/Handler.php | 39 +++---------------- lib/Listener/PostLoginListener.php | 2 +- lib/Model/SettingsMapper.php | 2 +- lib/Notifier/AdminNotifications.php | 4 +- lib/Push.php | 12 +++--- lib/Settings/Personal.php | 2 +- rector.php | 2 +- .../features/bootstrap/FeatureContext.php | 2 +- 13 files changed, 26 insertions(+), 55 deletions(-) diff --git a/lib/BackgroundJob/GenerateUserSettings.php b/lib/BackgroundJob/GenerateUserSettings.php index 4d90fa9d..e3235248 100644 --- a/lib/BackgroundJob/GenerateUserSettings.php +++ b/lib/BackgroundJob/GenerateUserSettings.php @@ -59,7 +59,7 @@ protected function run($argument): void { try { $this->settingsMapper->getSettingsByUser($user->getUID()); - } catch (DoesNotExistException $e) { + } catch (DoesNotExistException) { $settings = new Settings(); $settings->setUserId($user->getUID()); $settings->setNextSendTime(1); diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php index dd04ab74..20d40416 100644 --- a/lib/Command/Generate.php +++ b/lib/Command/Generate.php @@ -186,7 +186,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $this->notificationManager->notify($notification); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { $output->writeln('Error while sending the notification'); return 1; } diff --git a/lib/Command/TestPush.php b/lib/Command/TestPush.php index b174820d..80e3bc48 100644 --- a/lib/Command/TestPush.php +++ b/lib/Command/TestPush.php @@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->app->setOutput($output); $this->notificationManager->notify($notification); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { $output->writeln('Error while sending the notification'); return 1; } diff --git a/lib/Controller/EndpointController.php b/lib/Controller/EndpointController.php index 5d282437..c23ed6f1 100644 --- a/lib/Controller/EndpointController.php +++ b/lib/Controller/EndpointController.php @@ -145,7 +145,7 @@ public function getNotification(string $apiVersion, int $id): DataResponse { try { $notification = $this->handler->getById($id, $this->getCurrentUser()); - } catch (NotificationNotFoundException $e) { + } catch (NotificationNotFoundException) { return new DataResponse(null, Http::STATUS_NOT_FOUND); } @@ -231,7 +231,7 @@ public function deleteNotification(int $id): DataResponse { if ($deleted) { $this->push->pushDeleteToDevice($this->getCurrentUser(), [$id], $notification->getApp()); } - } catch (NotificationNotFoundException $e) { + } catch (NotificationNotFoundException) { } return new DataResponse(); diff --git a/lib/Controller/PushController.php b/lib/Controller/PushController.php index 622ab01b..26957bc2 100644 --- a/lib/Controller/PushController.php +++ b/lib/Controller/PushController.php @@ -70,7 +70,7 @@ public function registerDevice(string $pushTokenHash, string $devicePublicKey, s } if ( - strpos($devicePublicKey, '-----BEGIN PUBLIC KEY-----' . "\n") !== 0 || + !str_starts_with($devicePublicKey, '-----BEGIN PUBLIC KEY-----' . "\n") || ((\strlen($devicePublicKey) !== 450 || strpos($devicePublicKey, "\n" . '-----END PUBLIC KEY-----') !== 425) && (\strlen($devicePublicKey) !== 451 || strpos($devicePublicKey, "\n" . '-----END PUBLIC KEY-----' . "\n") !== 425)) ) { @@ -91,7 +91,7 @@ public function registerDevice(string $pushTokenHash, string $devicePublicKey, s } try { $token = $this->tokenProvider->getTokenById($tokenId); - } catch (InvalidTokenException $e) { + } catch (InvalidTokenException) { return new DataResponse(['message' => 'INVALID_SESSION_TOKEN'], Http::STATUS_BAD_REQUEST); } @@ -149,7 +149,7 @@ public function removeDevice(): DataResponse { $tokenId = (int)$this->session->get('token-id'); try { $token = $this->tokenProvider->getTokenById($tokenId); - } catch (InvalidTokenException $e) { + } catch (InvalidTokenException) { return new DataResponse(['message' => 'INVALID_SESSION_TOKEN'], Http::STATUS_BAD_REQUEST); } diff --git a/lib/Handler.php b/lib/Handler.php index d0f85cc0..ae5d923f 100644 --- a/lib/Handler.php +++ b/lib/Handler.php @@ -47,9 +47,6 @@ public function add(INotification $notification): int { /** * Count the notifications matching the given Notification - * - * @param INotification $notification - * @return int */ public function count(INotification $notification): int { $sql = $this->connection->getQueryBuilder(); @@ -68,7 +65,6 @@ public function count(INotification $notification): int { /** * Delete the notifications matching the given Notification * - * @param INotification $notification * @return array A Map with all deleted notifications [user => [notifications]] */ public function delete(INotification $notification): array { @@ -125,15 +121,12 @@ public function delete(INotification $notification): array { /** * Delete the notification of a given user - * - * @param string $user - * @return bool */ public function deleteByUser(string $user): bool { $notification = $this->manager->createNotification(); try { $notification->setUser($user); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { return false; } return !empty($this->delete($notification)); @@ -142,10 +135,6 @@ public function deleteByUser(string $user): bool { /** * Delete the notification matching the given id * - * @param int $id - * @param string $user - * @param INotification|null $notification - * @return bool * @throws NotificationNotFoundException */ public function deleteById(int $id, string $user, ?INotification $notification = null): bool { @@ -177,9 +166,6 @@ public function deleteIds(array $ids): void { /** * Get the notification matching the given id * - * @param int $id - * @param string $user - * @return INotification * @throws NotificationNotFoundException */ public function getById(int $id, string $user): INotification { @@ -198,7 +184,7 @@ public function getById(int $id, string $user): INotification { try { return $this->notificationFromRow($row); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { throw new NotificationNotFoundException('Could not create notification from database row'); } } @@ -206,7 +192,6 @@ public function getById(int $id, string $user): INotification { /** * Confirm that the notification ids still exist for the user * - * @param string $user * @param int[] $ids * @return int[] */ @@ -230,9 +215,6 @@ public function confirmIdsForUser(string $user, array $ids): array { /** * Get the notifications after (and excluding) the given id * - * @param int $startAfterId - * @param string $userId - * @param int $limit * @return array [notification_id => INotification] */ public function getAfterId(int $startAfterId, string $userId, int $limit = 25): array { @@ -249,7 +231,7 @@ public function getAfterId(int $startAfterId, string $userId, int $limit = 25): while ($row = $statement->fetch()) { try { $notifications[(int)$row['notification_id']] = $this->notificationFromRow($row); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { continue; } } @@ -261,11 +243,9 @@ public function getAfterId(int $startAfterId, string $userId, int $limit = 25): /** * Return the notifications matching the given Notification * - * @param INotification $notification - * @param int $limit * @return array [notification_id => INotification] */ - public function get(INotification $notification, $limit = 25): array { + public function get(INotification $notification, int $limit = 25): array { $sql = $this->connection->getQueryBuilder(); $sql->select('*') ->from('notifications') @@ -279,7 +259,7 @@ public function get(INotification $notification, $limit = 25): array { while ($row = $statement->fetch()) { try { $notifications[(int)$row['notification_id']] = $this->notificationFromRow($row); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { continue; } } @@ -290,9 +270,6 @@ public function get(INotification $notification, $limit = 25): array { /** * Add where statements to a query builder matching the given notification - * - * @param IQueryBuilder $sql - * @param INotification $notification */ protected function sqlWhere(IQueryBuilder $sql, INotification $notification) { if ($notification->getApp() !== '') { @@ -327,9 +304,6 @@ protected function sqlWhere(IQueryBuilder $sql, INotification $notification) { /** * Turn a notification into an input statement - * - * @param IQueryBuilder $sql - * @param INotification $notification */ protected function sqlInsert(IQueryBuilder $sql, INotification $notification) { $actions = []; @@ -359,9 +333,6 @@ protected function sqlInsert(IQueryBuilder $sql, INotification $notification) { /** * Turn a database row into a INotification - * - * @param array $row - * @return INotification * @throws \InvalidArgumentException */ protected function notificationFromRow(array $row): INotification { diff --git a/lib/Listener/PostLoginListener.php b/lib/Listener/PostLoginListener.php index 8395ad12..0d297eff 100644 --- a/lib/Listener/PostLoginListener.php +++ b/lib/Listener/PostLoginListener.php @@ -40,7 +40,7 @@ public function handle(Event $event): void { try { $this->settingsMapper->getSettingsByUser($userId); - } catch (DoesNotExistException $e) { + } catch (DoesNotExistException) { $defaultSoundNotification = $this->config->getAppValue(Application::APP_ID, 'sound_notification') === 'yes' ? 'yes' : 'no'; $defaultSoundTalk = $this->config->getAppValue(Application::APP_ID, 'sound_talk') === 'yes' ? 'yes' : 'no'; $defaultBatchtime = (int)$this->config->getAppValue(Application::APP_ID, 'setting_batchtime'); diff --git a/lib/Model/SettingsMapper.php b/lib/Model/SettingsMapper.php index 2bb28ec9..20a164b1 100644 --- a/lib/Model/SettingsMapper.php +++ b/lib/Model/SettingsMapper.php @@ -60,7 +60,7 @@ public function deleteSettingsByUser(string $userId): void { public function setBatchSettingForUser(string $userId, int $batchSetting): void { try { $settings = $this->getSettingsByUser($userId); - } catch (DoesNotExistException $e) { + } catch (DoesNotExistException) { $settings = new Settings(); $settings->setUserId($userId); /** @var Settings $settings */ diff --git a/lib/Notifier/AdminNotifications.php b/lib/Notifier/AdminNotifications.php index 1e3785e5..84f0790e 100644 --- a/lib/Notifier/AdminNotifications.php +++ b/lib/Notifier/AdminNotifications.php @@ -87,12 +87,12 @@ public function prepare(INotification $notification, string $languageCode): INot } $path1 = rtrim($file1->getPath(), '/'); - if (strpos($path1, '/' . $notification->getUser() . '/files/') === 0) { + if (str_starts_with($path1, '/' . $notification->getUser() . '/files/')) { // Remove /user/files/... [,,, $path1] = explode('/', $path1, 4); } $path2 = rtrim($file2->getPath(), '/'); - if (strpos($path2, '/' . $notification->getUser() . '/files/') === 0) { + if (str_starts_with($path2, '/' . $notification->getUser() . '/files/')) { // Remove /user/files/... [,,, $path2] = explode('/', $path2, 4); } diff --git a/lib/Push.php b/lib/Push.php index 146a5391..14d98092 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -325,7 +325,7 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf $this->payloadsToSend[$proxyServer][] = $payload; } catch (\JsonException $e) { $this->log->error('JSON error while encoding push notification: ' . $e->getMessage(), ['exception' => $e]); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { // Failed to encrypt message for device: public key is invalid $this->deletePushToken($device['token']); } @@ -431,7 +431,7 @@ public function pushDeleteToDevice(string $userId, ?array $notificationIds, stri } } } - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { // Failed to encrypt message for device: public key is invalid $this->deletePushToken($device['token']); } @@ -479,7 +479,7 @@ protected function sendNotificationsToProxies(): void { $body = (string)$response->getBody(); try { $bodyData = json_decode($body, true); - } catch (\JsonException $e) { + } catch (\JsonException) { $bodyData = null; } } catch (ClientException $e) { @@ -489,7 +489,7 @@ protected function sendNotificationsToProxies(): void { $body = $response->getBody()->getContents(); try { $bodyData = json_decode($body, true); - } catch (\JsonException $e) { + } catch (\JsonException) { $bodyData = null; } } catch (ServerException $e) { @@ -512,7 +512,7 @@ protected function sendNotificationsToProxies(): void { ]); $error = $e->getMessage() ?: 'no reason given'; - $this->printInfo('Could not send notification to push server [' . get_class($e) . ']: ' . $error); + $this->printInfo('Could not send notification to push server [' . $e::class . ']: ' . $error); continue; } @@ -569,7 +569,7 @@ protected function validateToken(int $tokenId, int $maxAge): bool { $this->printInfo('Device token "last checked" is older than 60 days: ' . $token->getLastCheck()); } return $token->getLastCheck() > $maxAge; - } catch (InvalidTokenException $e) { + } catch (InvalidTokenException) { // Token does not exist anymore, should drop the push device entry $this->printInfo('InvalidTokenException is thrown'); $this->deletePushToken($tokenId); diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index de3738e7..034cb651 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -73,7 +73,7 @@ public function getForm(): TemplateResponse { } else { $settingBatchTime = Settings::EMAIL_SEND_OFF; } - } catch (DoesNotExistException $e) { + } catch (DoesNotExistException) { $settings = new Settings(); $settings->setUserId($user->getUID()); $settings->setBatchTime(3600 * 3); diff --git a/rector.php b/rector.php index d4d3cdc8..a960a0e5 100644 --- a/rector.php +++ b/rector.php @@ -15,5 +15,5 @@ __DIR__ . '/tests/Integration', __DIR__ . '/tests/Unit', ]) - ->withPhpSets(php74: true) + ->withPhpSets(php81: true) ->withTypeCoverageLevel(0); diff --git a/tests/Integration/features/bootstrap/FeatureContext.php b/tests/Integration/features/bootstrap/FeatureContext.php index e603f76a..1712aef9 100644 --- a/tests/Integration/features/bootstrap/FeatureContext.php +++ b/tests/Integration/features/bootstrap/FeatureContext.php @@ -418,7 +418,7 @@ public function setCurrentUser(string $user) { public function assureUserExists(string $user) { try { $this->userExists($user); - } catch (ClientException $ex) { + } catch (ClientException) { $this->createUser($user); } $response = $this->userExists($user); From b9956e645a5ac5cbb767dee8407c6367841fff7a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 2 Oct 2024 08:11:03 +0200 Subject: [PATCH 5/8] tests: Strict type test files Signed-off-by: Joas Schilling --- tests/Unit/AppInfo/ApplicationTest.php | 16 +-- tests/Unit/AppInfo/RoutesTest.php | 5 +- tests/Unit/AppTest.php | 12 +- tests/Unit/CapabilitiesTest.php | 4 +- tests/Unit/Command/GenerateTest.php | 33 ++--- tests/Unit/Controller/APIControllerTest.php | 16 +-- .../Controller/EndpointControllerTest.php | 54 +++----- tests/Unit/Controller/PushControllerTest.php | 91 +++++-------- tests/Unit/HandlerTest.php | 21 +-- tests/Unit/Notifier/NotifierTest.php | 18 +-- tests/Unit/PushTest.php | 128 ++++++++---------- 11 files changed, 164 insertions(+), 234 deletions(-) diff --git a/tests/Unit/AppInfo/ApplicationTest.php b/tests/Unit/AppInfo/ApplicationTest.php index 1f5fbca0..e6aa7f9a 100644 --- a/tests/Unit/AppInfo/ApplicationTest.php +++ b/tests/Unit/AppInfo/ApplicationTest.php @@ -1,4 +1,6 @@ container = $this->app->getContainer(); } - public function testContainerAppName() { + public function testContainerAppName(): void { $this->app = new Application(); $this->assertEquals('notifications', $this->container->getAppName()); } - public function dataContainerQuery() { + public static function dataContainerQuery(): array { return [ // lib/ [App::class], @@ -62,10 +62,8 @@ public function dataContainerQuery() { /** * @dataProvider dataContainerQuery - * @param string $service - * @param string $expected */ - public function testContainerQuery($service, $expected = null) { + public function testContainerQuery(string $service, ?string $expected = null): void { if ($expected === null) { $expected = $service; } diff --git a/tests/Unit/AppInfo/RoutesTest.php b/tests/Unit/AppInfo/RoutesTest.php index 9c4c0df6..dd152504 100644 --- a/tests/Unit/AppInfo/RoutesTest.php +++ b/tests/Unit/AppInfo/RoutesTest.php @@ -1,5 +1,8 @@ assertIsArray($routes); $this->assertCount(1, $routes); diff --git a/tests/Unit/AppTest.php b/tests/Unit/AppTest.php index 3a78f49d..4cc63601 100644 --- a/tests/Unit/AppTest.php +++ b/tests/Unit/AppTest.php @@ -1,4 +1,6 @@ handler->expects($this->once()) diff --git a/tests/Unit/CapabilitiesTest.php b/tests/Unit/CapabilitiesTest.php index d0e9d352..62219de1 100644 --- a/tests/Unit/CapabilitiesTest.php +++ b/tests/Unit/CapabilitiesTest.php @@ -1,4 +1,6 @@ assertSame([ diff --git a/tests/Unit/Command/GenerateTest.php b/tests/Unit/Command/GenerateTest.php index 41f73262..096bee3a 100644 --- a/tests/Unit/Command/GenerateTest.php +++ b/tests/Unit/Command/GenerateTest.php @@ -1,4 +1,6 @@ createMock(IUser::class); $u->expects($createNotification ? $this->once() : $this->never()) diff --git a/tests/Unit/Controller/APIControllerTest.php b/tests/Unit/Controller/APIControllerTest.php index e3cb3931..0dff131e 100644 --- a/tests/Unit/Controller/APIControllerTest.php +++ b/tests/Unit/Controller/APIControllerTest.php @@ -1,4 +1,6 @@ createMock(IUser::class); $u->expects($createNotification ? $this->once() : $this->never()) diff --git a/tests/Unit/Controller/EndpointControllerTest.php b/tests/Unit/Controller/EndpointControllerTest.php index 49097c05..f30b1229 100644 --- a/tests/Unit/Controller/EndpointControllerTest.php +++ b/tests/Unit/Controller/EndpointControllerTest.php @@ -1,4 +1,6 @@ getMock(); } - public function dataListNotifications() { + public function dataListNotifications(): array { return [ [ 'v2', @@ -149,7 +136,7 @@ public function dataListNotifications() { * @param string $expectedETag * @param array $expectedData */ - public function testListNotifications($apiVersion, array $notifications, $expectedETag, array $expectedData) { + public function testListNotifications(string $apiVersion, array $notifications, string $expectedETag, array $expectedData): void { $controller = $this->getController([ 'notificationToArray', ]); @@ -344,7 +331,7 @@ public function testGetNotification($apiVersion, $id, $username) { $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - public function dataGetNotificationNoId() { + public function dataGetNotificationNoId(): array { $notification = $this->getMockBuilder(INotification::class) ->getMock(); @@ -358,13 +345,8 @@ public function dataGetNotificationNoId() { /** * @dataProvider dataGetNotificationNoId - * @param string $apiVersion - * @param bool $hasNotifiers - * @param mixed $id - * @param bool $called - * @param NotificationNotFoundException|INotification $notification */ - public function testGetNotificationNoId($apiVersion, $hasNotifiers, $id, $called, $notification) { + public function testGetNotificationNoId(string $apiVersion, bool $hasNotifiers, int $id, bool $called, NotificationNotFoundException|INotification $notification): void { $controller = $this->getController(); $this->manager->expects($this->once()) diff --git a/tests/Unit/Controller/PushControllerTest.php b/tests/Unit/Controller/PushControllerTest.php index b9f9094e..1720015e 100644 --- a/tests/Unit/Controller/PushControllerTest.php +++ b/tests/Unit/Controller/PushControllerTest.php @@ -1,4 +1,6 @@ identityProof = $this->createMock(Manager::class); } - protected function getController(array $methods = []) { + protected function getController(array $methods = []): PushController|MockObject { if (empty($methods)) { return new PushController( 'notifications', @@ -130,7 +124,7 @@ protected function getController(array $methods = []) { ->getMock(); } - public function dataRegisterDevice() { + public static function dataRegisterDevice(): array { return [ 'not authenticated' => [ '', @@ -178,7 +172,7 @@ public function dataRegisterDevice() { ], 'device key invalid start' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - substr($this->devicePublicKey, 1), + substr(self::$devicePublicKey, 1), '', true, 0, @@ -189,7 +183,7 @@ public function dataRegisterDevice() { ], 'device key invalid end' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - substr($this->devicePublicKey, 0, -1), + substr(self::$devicePublicKey, 0, -1), '', true, 0, @@ -200,7 +194,7 @@ public function dataRegisterDevice() { ], 'device key too much end' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey . "\n\n", + self::$devicePublicKey . "\n\n", '', true, 0, @@ -211,7 +205,7 @@ public function dataRegisterDevice() { ], 'device key without trailing new line' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, '', true, 0, @@ -222,7 +216,7 @@ public function dataRegisterDevice() { ], 'device key with trailing new line' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey . "\n", + self::$devicePublicKey . "\n", '', true, 0, @@ -233,7 +227,7 @@ public function dataRegisterDevice() { ], 'invalid push proxy' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, 'localhost', true, 0, @@ -244,7 +238,7 @@ public function dataRegisterDevice() { ], 'using localhost' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, 'http://localhost/', true, 23, @@ -255,7 +249,7 @@ public function dataRegisterDevice() { ], 'using localhost with port' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, 'http://localhost:8088/', true, 23, @@ -266,7 +260,7 @@ public function dataRegisterDevice() { ], 'using production' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, 'https://push-notifications.nextcloud.com/', true, 23, @@ -277,14 +271,14 @@ public function dataRegisterDevice() { ], 'created or updated' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, 'https://push-notifications.nextcloud.com/', true, 23, true, true, [ - 'publicKey' => $this->userPublicKey, + 'publicKey' => self::$userPublicKey, 'deviceIdentifier' => 'XUCEZ1EHvTUcVhIvrQQQ1XcP0ZD2BFdFqw4EYbOhBfiEgXgirurR4x/ve4GSSyfivvbQOdOkZUM+g4m+tSb0Ew==', 'signature' => 'LRhbXO71WYX9qqDbQX7C+87YaaFfWoT/vG0DlaXdBz6+lhyOA0dw/1Ggz3fd7RerCQ0MfgnnTyxO+cSeRpUaPdA2yPjfoiPpfYA5SOJQGF3comS/HYna3fHiFDbOoM3BJOnjvqiSZdxA/ICdyl2mEEC5wO7AZ4OZKBTa5XfL7eSCXZLEv1YldqcLOStbXrI7voDQocTMJxoQZI/j8BVcf2i3D6F454aXIFDrYYzC2PQY+CKJoXZW0m0RMWaTM2B8tBmFFwrmaGLDqcjjpd33TsTtsV5DB7WimffLBPpOuGV4Z1Kiagp/mxpPLz2NImNV79mDX9gY3ZppCZTwChP5qQ==', ], @@ -292,14 +286,14 @@ public function dataRegisterDevice() { ], 'not updated' => [ 'bb9b52140661ee4f2c31e02ea50a8f67ba353bffc58aa981718f90bd2aa2bd8fc08cad4c0b3ed8f7eb9d79d6a577be75d084bbeb963da1ad74d9279e0014e472', - $this->devicePublicKey, + self::$devicePublicKey, 'https://push-notifications.nextcloud.com/', true, 42, true, false, [ - 'publicKey' => $this->userPublicKey, + 'publicKey' => self::$userPublicKey, 'deviceIdentifier' => 'x9vSImcGjhzR9BfZ/XbbUqqCCNC4bHKsX7vkQWNZRd1/MiY+OuF02fx8K08My0RpkNnwj/rQ/gVSU1oEdFwkww==', 'signature' => 'J9AcdJt5youJmMnBhS+Cc9ytArynIKtCRoNf/m0oOFO/e0hWHqs1NRdQBe81qzYIjf0+bj0Q97X9Xv1rnVJesPkQUbGaa4nAPt+viGSfvzTptjX4LKgqm8B3UkduBA262IcaWgM5P84gUqelkQIC1nIqq/MJTuC6oQ5lUwIV1a92ZurDjhwH4b3f7/ZLTTOTRD0DWN9W/yOyF1qECivgePR3eu+mkcBzXVU/TDZDJic9G7xhqcTnWV6qk+aKyzdNo1tu5W7mF+v5vF6rrGZrq55vPLWAHApTD7P+NFV01BnaCuN7/qGJNVs7m7EH03jpOw7y3jqNMmcmonYrJSMVqg==', ], @@ -310,18 +304,8 @@ public function dataRegisterDevice() { /** * @dataProvider dataRegisterDevice - * - * @param string $pushTokenHash - * @param string $devicePublicKey - * @param string $proxyServer - * @param bool $userIsValid - * @param int $tokenId - * @param bool $tokenIsValid - * @param bool $deviceCreated - * @param array $payload - * @param int $status */ - public function testRegisterDevice($pushTokenHash, $devicePublicKey, $proxyServer, $userIsValid, $tokenId, $tokenIsValid, $deviceCreated, $payload, $status) { + public function testRegisterDevice(string $pushTokenHash, string $devicePublicKey, string $proxyServer, bool $userIsValid, int $tokenId, bool $tokenIsValid, ?bool $deviceCreated, array $payload, int $status): void { $controller = $this->getController([ 'savePushToken', ]); @@ -355,10 +339,10 @@ public function testRegisterDevice($pushTokenHash, $devicePublicKey, $proxyServe $key = $this->createMock(Key::class); $key->expects($this->once()) ->method('getPrivate') - ->willReturn($this->userPrivateKey); + ->willReturn(self::$userPrivateKey); $key->expects($this->once()) ->method('getPublic') - ->willReturn($this->userPublicKey); + ->willReturn(self::$userPublicKey); $this->identityProof->expects($this->once()) ->method('getKey') @@ -385,7 +369,7 @@ public function testRegisterDevice($pushTokenHash, $devicePublicKey, $proxyServe $this->assertSame($payload, $response->getData()); } - public function dataRemoveDevice() { + public static function dataRemoveDevice(): array { return [ 'not authenticated' => [ false, @@ -433,15 +417,8 @@ public function dataRemoveDevice() { /** * @dataProvider dataRemoveDevice - * - * @param bool $userIsValid - * @param int $tokenId - * @param bool $tokenIsValid - * @param bool $deviceDeleted - * @param array $payload - * @param int $status */ - public function testRemoveDevice($userIsValid, $tokenId, $tokenIsValid, $deviceDeleted, $payload, $status) { + public function testRemoveDevice(bool $userIsValid, int $tokenId, bool $tokenIsValid, ?bool $deviceDeleted, array $payload, int $status): void { $controller = $this->getController([ 'deletePushToken', ]); diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php index 5c9c2f93..b9f66c74 100644 --- a/tests/Unit/HandlerTest.php +++ b/tests/Unit/HandlerTest.php @@ -1,4 +1,6 @@ handler = new Handler( - \OC::$server->getDatabaseConnection(), - \OC::$server->getNotificationManager() + \OCP\Server::get(IDBConnection::class), + \OCP\Server::get(IManager::class), ); $this->handler->delete($this->getNotification([ @@ -36,7 +41,7 @@ protected function setUp(): void { ])); } - public function testFull() { + public function testFull(): void { $notification = $this->getNotification([ 'getApp' => 'testing_notifications', 'getUser' => 'test_user1', @@ -92,7 +97,7 @@ public function testFull() { $this->assertSame(0, $this->handler->count($limitedNotification2), 'Wrong notification count for user2 after deleting'); } - public function testFullEmptyMessageForOracle() { + public function testFullEmptyMessageForOracle(): void { $notification = $this->getNotification([ 'getApp' => 'testing_notifications', 'getUser' => 'test_user1', @@ -148,7 +153,7 @@ public function testFullEmptyMessageForOracle() { $this->assertSame(0, $this->handler->count($limitedNotification2), 'Wrong notification count for user2 after deleting'); } - public function testDeleteById() { + public function testDeleteById(): void { $notification = $this->getNotification([ 'getApp' => 'testing_notifications', 'getUser' => 'test_user1', @@ -210,11 +215,7 @@ public function testDeleteById() { $this->assertSame(0, $this->handler->count($limitedNotification), 'Wrong notification count for user1 after deleting'); } - /** - * @param array $values - * @return INotification|\PHPUnit_Framework_MockObject_MockObject - */ - protected function getNotification(array $values = []) { + protected function getNotification(array $values = []): INotification&MockObject { $notification = $this->getMockBuilder(INotification::class) ->getMock(); diff --git a/tests/Unit/Notifier/NotifierTest.php b/tests/Unit/Notifier/NotifierTest.php index 266b0406..9610821d 100644 --- a/tests/Unit/Notifier/NotifierTest.php +++ b/tests/Unit/Notifier/NotifierTest.php @@ -1,4 +1,6 @@ createMock(INotification::class); $notification->expects($this->exactly(2)) @@ -64,7 +66,7 @@ public function testPrepareWrongApp(): void { } public function testPrepareWrongSubject(): void { - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification->expects($this->once()) @@ -89,7 +91,7 @@ public static function dataPrepare(): array { * @dataProvider dataPrepare */ public function testPrepare(string $subject, array $subjectParams, array $messageParams, bool $setMessage): void { - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification->expects($this->once()) diff --git a/tests/Unit/PushTest.php b/tests/Unit/PushTest.php index 52fac1e2..e5fe6dfd 100644 --- a/tests/Unit/PushTest.php +++ b/tests/Unit/PushTest.php @@ -1,4 +1,6 @@ db = \OC::$server->getDatabaseConnection(); + $this->db = \OCP\Server::get(IDBConnection::class); $this->notificationManager = $this->createMock(INotificationManager::class); $this->config = $this->createMock(IConfig::class); $this->tokenProvider = $this->createMock(IProvider::class); @@ -88,9 +78,8 @@ protected function setUp(): void { /** * @param string[] $methods - * @return Push|MockObject */ - protected function getPush(array $methods = []) { + protected function getPush(array $methods = []): Push|MockObject { if (!empty($methods)) { return $this->getMockBuilder(Push::class) ->setConstructorArgs([ @@ -124,7 +113,7 @@ protected function getPush(array $methods = []) { ); } - public function testPushToDeviceNoInternet() { + public function testPushToDeviceNoInternet(): void { $push = $this->getPush(['createFakeUserObject']); $this->config->expects($this->once()) @@ -138,13 +127,13 @@ public function testPushToDeviceNoInternet() { $push->expects($this->never()) ->method('createFakeUserObject'); - /** @var INotification|MockObject$notification */ + /** @var INotification&MockObject$notification */ $notification = $this->createMock(INotification::class); $push->pushToDevice(23, $notification); } - public function testPushToDeviceNoDevices() { + public function testPushToDeviceNoDevices(): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser']); $this->keyManager->expects($this->never()) ->method('getKey'); @@ -156,13 +145,13 @@ public function testPushToDeviceNoDevices() { ->with('has_internet_connection', true) ->willReturn(true); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') ->willReturn('valid'); - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -177,7 +166,7 @@ public function testPushToDeviceNoDevices() { $push->pushToDevice(42, $notification); } - public function testPushToDeviceNotPrepared() { + public function testPushToDeviceNotPrepared(): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser']); $this->keyManager->expects($this->never()) ->method('getKey'); @@ -189,13 +178,13 @@ public function testPushToDeviceNotPrepared() { ->with('has_internet_connection', true) ->willReturn(true); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') ->willReturn('valid'); - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -223,7 +212,7 @@ public function testPushToDeviceNotPrepared() { $push->pushToDevice(1337, $notification); } - public function testPushToDeviceInvalidToken() { + public function testPushToDeviceInvalidToken(): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser', 'encryptAndSign', 'deletePushToken']); $this->clientService->expects($this->never()) ->method('newClient'); @@ -233,13 +222,13 @@ public function testPushToDeviceInvalidToken() { ->with('has_internet_connection', true) ->willReturn(true); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') ->willReturn('valid'); - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -266,7 +255,7 @@ public function testPushToDeviceInvalidToken() { ->willReturnArgument(0); - /** @var Key|MockObject $key */ + /** @var Key&MockObject $key */ $key = $this->createMock(Key::class); $this->keyManager->expects($this->once()) @@ -288,7 +277,7 @@ public function testPushToDeviceInvalidToken() { $push->pushToDevice(2018, $notification); } - public function testPushToDeviceEncryptionError() { + public function testPushToDeviceEncryptionError(): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser', 'encryptAndSign', 'deletePushToken', 'validateToken']); $this->clientService->expects($this->never()) ->method('newClient'); @@ -298,13 +287,13 @@ public function testPushToDeviceEncryptionError() { ->with('has_internet_connection', true) ->willReturn(true); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') ->willReturn('valid'); - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -330,7 +319,7 @@ public function testPushToDeviceEncryptionError() { ->with($notification, 'ru') ->willReturnArgument(0); - /** @var Key|MockObject $key */ + /** @var Key&MockObject $key */ $key = $this->createMock(Key::class); $this->keyManager->expects($this->once()) @@ -352,16 +341,16 @@ public function testPushToDeviceEncryptionError() { $push->pushToDevice(1970, $notification); } - public function testPushToDeviceNoFairUse() { + public function testPushToDeviceNoFairUse(): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser', 'encryptAndSign', 'deletePushToken', 'validateToken', 'deletePushTokenByDeviceIdentifier']); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') ->willReturn('valid'); - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -394,7 +383,7 @@ public function testPushToDeviceNoFairUse() { ->with($notification, 'ru') ->willReturnArgument(0); - /** @var Key|MockObject $key */ + /** @var Key&MockObject $key */ $key = $this->createMock(Key::class); $this->keyManager->expects($this->once()) @@ -430,7 +419,7 @@ public function testPushToDeviceNoFairUse() { $push->pushToDevice(207787, $notification); } - public function dataPushToDeviceSending() { + public static function dataPushToDeviceSending(): array { return [ [true], [false], @@ -439,18 +428,17 @@ public function dataPushToDeviceSending() { /** * @dataProvider dataPushToDeviceSending - * @param bool $isDebug */ - public function testPushToDeviceSending($isDebug) { + public function testPushToDeviceSending(bool $isDebug): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser', 'encryptAndSign', 'deletePushToken', 'validateToken', 'deletePushTokenByDeviceIdentifier']); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') ->willReturn('valid'); - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -508,7 +496,7 @@ public function testPushToDeviceSending($isDebug) { ->with($notification, 'ru') ->willReturnArgument(0); - /** @var Key|MockObject $key */ + /** @var Key&MockObject $key */ $key = $this->createMock(Key::class); $this->keyManager->expects($this->once()) @@ -527,7 +515,7 @@ public function testPushToDeviceSending($isDebug) { $push->expects($this->never()) ->method('deletePushToken'); - /** @var IClient|MockObject $client */ + /** @var IClient&MockObject $client */ $client = $this->createMock(IClient::class); $this->clientService->expects($this->once()) @@ -540,12 +528,12 @@ public function testPushToDeviceSending($isDebug) { ->willReturn(true); // Call 1 - /** @var ResponseInterface|MockObject $response1 */ + /** @var ResponseInterface&MockObject $response1 */ $response1 = $this->createMock(ResponseInterface::class); $response1->expects($this->once()) ->method('getStatusCode') ->willReturn(Http::STATUS_BAD_REQUEST); - /** @var StreamInterface|MockObject $body1 */ + /** @var StreamInterface&MockObject $body1 */ $body1 = $this->createMock(StreamInterface::class); $body1->expects($this->once()) ->method('getContents') @@ -558,9 +546,9 @@ public function testPushToDeviceSending($isDebug) { ->willReturn($response1); // Call 2 - /** @var ResponseInterface|MockObject $response1 */ + /** @var ResponseInterface&MockObject $response1 */ $response2 = $this->createMock(ResponseInterface::class); - /** @var StreamInterface|MockObject $body2 */ + /** @var StreamInterface&MockObject $body2 */ $body2 = $this->createMock(StreamInterface::class); $body2->expects($this->once()) ->method('getContents') @@ -574,23 +562,23 @@ public function testPushToDeviceSending($isDebug) { // Call 3 - /** @var IResponse|MockObject $response1 */ + /** @var IResponse&MockObject $response1 */ $response3 = $this->createMock(IResponse::class); $response3->expects($this->once()) ->method('getStatusCode') ->willReturn(Http::STATUS_OK); - /** @var StreamInterface|MockObject $body3 */ + /** @var StreamInterface&MockObject $body3 */ $body3 = $this->createMock(StreamInterface::class); $response3->method('getBody') ->willReturn(''); // Call 4 - /** @var ResponseInterface|MockObject $response1 */ + /** @var ResponseInterface&MockObject $response1 */ $response4 = $this->createMock(ResponseInterface::class); $response4->expects($this->once()) ->method('getStatusCode') ->willReturn(Http::STATUS_BAD_REQUEST); - /** @var StreamInterface|MockObject $body4 */ + /** @var StreamInterface&MockObject $body4 */ $body4 = $this->createMock(StreamInterface::class); $body4->expects($this->once()) ->method('getContents') @@ -681,7 +669,7 @@ public function testPushToDeviceSending($isDebug) { $push->pushToDevice(207787, $notification); } - public function dataPushToDeviceTalkNotification() { + public static function dataPushToDeviceTalkNotification(): array { return [ [['nextcloud'], false, 0], [['nextcloud'], true, 0], @@ -697,13 +685,11 @@ public function dataPushToDeviceTalkNotification() { /** * @dataProvider dataPushToDeviceTalkNotification * @param string[] $deviceTypes - * @param bool $isTalkNotification - * @param int $pushedDevice */ - public function testPushToDeviceTalkNotification(array $deviceTypes, $isTalkNotification, $pushedDevice) { + public function testPushToDeviceTalkNotification(array $deviceTypes, bool $isTalkNotification, ?int $pushedDevice): void { $push = $this->getPush(['createFakeUserObject', 'getDevicesForUser', 'encryptAndSign', 'deletePushToken', 'validateToken']); - /** @var INotification|MockObject $notification */ + /** @var INotification&MockObject $notification */ $notification = $this->createMock(INotification::class); $notification ->method('getUser') @@ -719,7 +705,7 @@ public function testPushToDeviceTalkNotification(array $deviceTypes, $isTalkNoti ->willReturn('notifications'); } - /** @var IUser|MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $push->expects($this->once()) @@ -749,7 +735,7 @@ public function testPushToDeviceTalkNotification(array $deviceTypes, $isTalkNoti ->with($notification, 'ru') ->willReturnArgument(0); - /** @var Key|MockObject $key */ + /** @var Key&MockObject $key */ $key = $this->createMock(Key::class); $this->keyManager->expects($this->once()) @@ -776,14 +762,14 @@ public function testPushToDeviceTalkNotification(array $deviceTypes, $isTalkNoti ->with($this->anything(), $devices[$pushedDevice], $this->anything(), $this->anything(), $isTalkNotification) ->willReturn(['Payload']); - /** @var IClient|MockObject $client */ + /** @var IClient&MockObject $client */ $client = $this->createMock(IClient::class); $this->clientService->expects($this->once()) ->method('newClient') ->willReturn($client); - /** @var IResponse|MockObject $response1 */ + /** @var IResponse&MockObject $response1 */ $response = $this->createMock(IResponse::class); $response->expects($this->once()) ->method('getStatusCode') From ebfd9cfc07c093115fafcdf60f666c05d84b1854 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 2 Oct 2024 08:26:18 +0200 Subject: [PATCH 6/8] fix(php): Use constructor promotion Signed-off-by: Joas Schilling --- lib/BackgroundJob/GenerateUserSettings.php | 17 +--- lib/BackgroundJob/SendNotificationMails.php | 16 ++-- lib/Command/TestPush.php | 23 ++---- lib/FakeUser.php | 7 +- lib/Handler.php | 17 +--- .../BeforeTemplateRenderedListener.php | 19 ++--- lib/Listener/PostLoginListener.php | 10 +-- lib/Listener/UserCreatedListener.php | 11 +-- lib/Listener/UserDeletedListener.php | 9 +-- lib/MailNotifications.php | 74 ++++-------------- .../Version2010Date20210218082811.php | 8 +- .../Version2011Date20220826074907.php | 8 +- lib/Push.php | 78 +++++-------------- lib/Settings/AdminSection.php | 10 +-- lib/Settings/Personal.php | 32 ++------ lib/Settings/PersonalSection.php | 13 +--- tests/psalm-baseline.xml | 16 ++-- 17 files changed, 97 insertions(+), 271 deletions(-) diff --git a/lib/BackgroundJob/GenerateUserSettings.php b/lib/BackgroundJob/GenerateUserSettings.php index e3235248..2d6bc216 100644 --- a/lib/BackgroundJob/GenerateUserSettings.php +++ b/lib/BackgroundJob/GenerateUserSettings.php @@ -18,25 +18,14 @@ use OCP\IUserManager; class GenerateUserSettings extends TimedJob { - /** @var IDBConnection */ - private $connection; - /** @var IUserManager */ - private $userManager; - /** @var SettingsMapper */ - private $settingsMapper; - public function __construct( ITimeFactory $time, - IDBConnection $connection, - IUserManager $userManager, - SettingsMapper $settingsMapper, + private IDBConnection $connection, + private IUserManager $userManager, + private SettingsMapper $settingsMapper, ) { parent::__construct($time); - $this->connection = $connection; - $this->userManager = $userManager; - $this->settingsMapper = $settingsMapper; - // run every day $this->setInterval(24 * 60 * 60); } diff --git a/lib/BackgroundJob/SendNotificationMails.php b/lib/BackgroundJob/SendNotificationMails.php index b6d09d52..74510557 100644 --- a/lib/BackgroundJob/SendNotificationMails.php +++ b/lib/BackgroundJob/SendNotificationMails.php @@ -13,18 +13,12 @@ use OCP\BackgroundJob\TimedJob; class SendNotificationMails extends TimedJob { - /** @var MailNotifications */ - protected $mailNotifications; - /** @var bool */ - protected $isCLI; - - public function __construct(ITimeFactory $timeFactory, - MailNotifications $mailNotifications, - bool $isCLI) { + public function __construct( + ITimeFactory $timeFactory, + private MailNotifications $mailNotifications, + private bool $isCLI, + ) { parent::__construct($timeFactory); - - $this->mailNotifications = $mailNotifications; - $this->isCLI = $isCLI; } protected function run($argument): void { diff --git a/lib/Command/TestPush.php b/lib/Command/TestPush.php index 80e3bc48..40758296 100644 --- a/lib/Command/TestPush.php +++ b/lib/Command/TestPush.php @@ -21,26 +21,13 @@ use Symfony\Component\Console\Output\OutputInterface; class TestPush extends Command { - /** @var ITimeFactory */ - protected $timeFactory; - /** @var IUserManager */ - protected $userManager; - /** @var IManager */ - protected $notificationManager; - /** @var App */ - protected $app; - public function __construct( - ITimeFactory $timeFactory, - IUserManager $userManager, - IManager $notificationManager, - App $app) { + protected ITimeFactory $timeFactory, + protected IUserManager $userManager, + protected IManager $notificationManager, + protected App $app, + ) { parent::__construct(); - - $this->timeFactory = $timeFactory; - $this->userManager = $userManager; - $this->notificationManager = $notificationManager; - $this->app = $app; } protected function configure(): void { diff --git a/lib/FakeUser.php b/lib/FakeUser.php index 45ce6c00..ee737058 100644 --- a/lib/FakeUser.php +++ b/lib/FakeUser.php @@ -11,10 +11,9 @@ use OCP\IUser; class FakeUser implements IUser { - protected string $userId; - - public function __construct(string $userId) { - $this->userId = $userId; + public function __construct( + protected string $userId, + ) { } public function getUID(): string { diff --git a/lib/Handler.php b/lib/Handler.php index ae5d923f..a78e3aac 100644 --- a/lib/Handler.php +++ b/lib/Handler.php @@ -18,23 +18,14 @@ use OCP\Notification\INotification; class Handler { - /** @var IDBConnection */ - protected $connection; - - /** @var IManager */ - protected $manager; - - public function __construct(IDBConnection $connection, - IManager $manager) { - $this->connection = $connection; - $this->manager = $manager; + public function __construct( + protected IDBConnection $connection, + protected IManager $manager, + ) { } /** * Add a new notification to the database - * - * @param INotification $notification - * @return int */ public function add(INotification $notification): int { $sql = $this->connection->getQueryBuilder(); diff --git a/lib/Listener/BeforeTemplateRenderedListener.php b/lib/Listener/BeforeTemplateRenderedListener.php index 5a85715a..0a4822af 100644 --- a/lib/Listener/BeforeTemplateRenderedListener.php +++ b/lib/Listener/BeforeTemplateRenderedListener.php @@ -25,19 +25,12 @@ * @template-implements IEventListener */ class BeforeTemplateRenderedListener implements IEventListener { - protected IConfig $config; - protected IUserSession $userSession; - protected IInitialState $initialState; - protected IManager $notificationManager; - - public function __construct(IConfig $config, - IUserSession $userSession, - IInitialState $initialState, - IManager $notificationManager) { - $this->config = $config; - $this->userSession = $userSession; - $this->initialState = $initialState; - $this->notificationManager = $notificationManager; + public function __construct( + protected IConfig $config, + protected IUserSession $userSession, + protected IInitialState $initialState, + protected IManager $notificationManager, + ) { } public function handle(Event $event): void { diff --git a/lib/Listener/PostLoginListener.php b/lib/Listener/PostLoginListener.php index 0d297eff..1a43b545 100644 --- a/lib/Listener/PostLoginListener.php +++ b/lib/Listener/PostLoginListener.php @@ -22,12 +22,10 @@ * @template-implements IEventListener */ class PostLoginListener implements IEventListener { - private SettingsMapper $settingsMapper; - private IConfig $config; - - public function __construct(SettingsMapper $settingsMapper, IConfig $config) { - $this->settingsMapper = $settingsMapper; - $this->config = $config; + public function __construct( + private SettingsMapper $settingsMapper, + private IConfig $config, + ) { } public function handle(Event $event): void { diff --git a/lib/Listener/UserCreatedListener.php b/lib/Listener/UserCreatedListener.php index b087130f..b55540e7 100644 --- a/lib/Listener/UserCreatedListener.php +++ b/lib/Listener/UserCreatedListener.php @@ -20,13 +20,10 @@ * @template-implements IEventListener */ class UserCreatedListener implements IEventListener { - private SettingsMapper $settingsMapper; - private IConfig $config; - - - public function __construct(SettingsMapper $settingsMapper, IConfig $config) { - $this->settingsMapper = $settingsMapper; - $this->config = $config; + public function __construct( + private SettingsMapper $settingsMapper, + private IConfig $config, + ) { } public function handle(Event $event): void { diff --git a/lib/Listener/UserDeletedListener.php b/lib/Listener/UserDeletedListener.php index 1f573155..06cd3494 100644 --- a/lib/Listener/UserDeletedListener.php +++ b/lib/Listener/UserDeletedListener.php @@ -19,15 +19,10 @@ * @template-implements IEventListener */ class UserDeletedListener implements IEventListener { - private Handler $handler; - private SettingsMapper $settingsMapper; - public function __construct( - Handler $handler, - SettingsMapper $settingsMapper, + private Handler $handler, + private SettingsMapper $settingsMapper, ) { - $this->handler = $handler; - $this->settingsMapper = $settingsMapper; } public function handle(Event $event): void { diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index 745b9580..9a15ace3 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -30,71 +30,23 @@ use Psr\Log\LoggerInterface; class MailNotifications { - /** @var IConfig */ - private $config; - - /** @var IManager */ - private $manager; - - /** @var Handler */ - protected $handler; - - /** @var IUserManager */ - private $userManager; - - /** @var LoggerInterface */ - private $logger; - - /** @var IMailer */ - private $mailer; - - /** @var IURLGenerator */ - private $urlGenerator; - - /** @var Defaults */ - private $defaults; - - /** @var IFactory */ - private $l10nFactory; - - /** @var IDateTimeFormatter */ - private $dateFormatter; - - /** @var ITimeFactory */ - protected $timeFactory; - - /** @var SettingsMapper */ - protected $settingsMapper; - public const BATCH_SIZE_CLI = 500; public const BATCH_SIZE_WEB = 25; public function __construct( - IConfig $config, - IManager $manager, - Handler $handler, - IUserManager $userManager, - LoggerInterface $logger, - IMailer $mailer, - IURLGenerator $urlGenerator, - Defaults $defaults, - IFactory $l10nFactory, - IDateTimeFormatter $dateTimeFormatter, - ITimeFactory $timeFactory, - SettingsMapper $settingsMapper, + protected IConfig $config, + protected IManager $manager, + protected Handler $handler, + protected IUserManager $userManager, + protected LoggerInterface $logger, + protected IMailer $mailer, + protected IURLGenerator $urlGenerator, + protected Defaults $defaults, + protected IFactory $l10nFactory, + protected IDateTimeFormatter $dateFormatter, + protected ITimeFactory $timeFactory, + protected SettingsMapper $settingsMapper, ) { - $this->config = $config; - $this->manager = $manager; - $this->handler = $handler; - $this->userManager = $userManager; - $this->logger = $logger; - $this->mailer = $mailer; - $this->urlGenerator = $urlGenerator; - $this->defaults = $defaults; - $this->l10nFactory = $l10nFactory; - $this->dateFormatter = $dateTimeFormatter; - $this->timeFactory = $timeFactory; - $this->settingsMapper = $settingsMapper; } /** @@ -358,7 +310,7 @@ protected function getHTMLMessage(INotification $notification): string { /** * replace the given parameters in the input content string for display in an email * - * @param array [string => string] $parameters + * @param array> $parameters * @param string $contentString * @return string $contentString with parameters processed */ diff --git a/lib/Migration/Version2010Date20210218082811.php b/lib/Migration/Version2010Date20210218082811.php index ac99e466..d15ee73e 100644 --- a/lib/Migration/Version2010Date20210218082811.php +++ b/lib/Migration/Version2010Date20210218082811.php @@ -21,11 +21,9 @@ * Recreate notifications_pushtoken(s) with a primary key for cluster support */ class Version2010Date20210218082811 extends SimpleMigrationStep { - /** @var IDBConnection */ - protected $connection; - - public function __construct(IDBConnection $connection) { - $this->connection = $connection; + public function __construct( + protected IDBConnection $connection, + ) { } /** diff --git a/lib/Migration/Version2011Date20220826074907.php b/lib/Migration/Version2011Date20220826074907.php index bdbe6fbd..aea06e35 100644 --- a/lib/Migration/Version2011Date20220826074907.php +++ b/lib/Migration/Version2011Date20220826074907.php @@ -15,11 +15,9 @@ use OCP\Migration\SimpleMigrationStep; class Version2011Date20220826074907 extends SimpleMigrationStep { - /** @var IDBConnection */ - protected $connection; - - public function __construct(IDBConnection $connection) { - $this->connection = $connection; + public function __construct( + protected IDBConnection $connection, + ) { } public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { diff --git a/lib/Push.php b/lib/Push.php index 14d98092..e71403e1 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -37,89 +37,53 @@ use Symfony\Component\Console\Output\OutputInterface; class Push { - /** @var IDBConnection */ - protected $db; - /** @var INotificationManager */ - protected $notificationManager; - /** @var IConfig */ - protected $config; - /** @var IProvider */ - protected $tokenProvider; - /** @var Manager */ - private $keyManager; - /** @var IClientService */ - protected $clientService; - /** @var ICache */ - protected $cache; - /** @var IUserStatusManager */ - protected $userStatusManager; - /** @var IFactory */ - protected $l10nFactory; - /** @var LoggerInterface */ - protected $log; - /** @var OutputInterface */ - protected $output; + protected ICache $cache; + protected ?OutputInterface $output = null; /** - * @var array * @psalm-var array> */ - protected $payloadsToSend = []; - - /** @var bool */ - protected $deferPreparing = false; - /** @var bool */ - protected $deferPayloads = false; + protected array $payloadsToSend = []; + protected bool $deferPreparing = false; + protected bool $deferPayloads = false; /** * @var array[] $userId => $appId => $notificationIds * @psalm-var array>> */ - protected $deletesToPush = []; + protected array $deletesToPush = []; /** - * @var bool[] $userId => true * @psalm-var array */ - protected $deleteAllsToPush = []; + protected array $deleteAllsToPush = []; /** @var INotification[] */ - protected $notificationsToPush = []; + protected array $notificationsToPush = []; /** - * @var ?IUserStatus[] * @psalm-var array */ - protected $userStatuses = []; + protected array $userStatuses = []; /** - * @var array[] * @psalm-var array> */ - protected $userDevices = []; + protected array $userDevices = []; /** @var string[] */ - protected $loadDevicesForUsers = []; + protected array $loadDevicesForUsers = []; /** @var string[] */ - protected $loadStatusForUsers = []; + protected array $loadStatusForUsers = []; public function __construct( - IDBConnection $connection, - INotificationManager $notificationManager, - IConfig $config, - IProvider $tokenProvider, - Manager $keyManager, - IClientService $clientService, + protected IDBConnection $db, + protected INotificationManager $notificationManager, + protected IConfig $config, + protected IProvider $tokenProvider, + protected Manager $keyManager, + protected IClientService $clientService, ICacheFactory $cacheFactory, - IUserStatusManager $userStatusManager, - IFactory $l10nFactory, + protected IUserStatusManager $userStatusManager, + protected IFactory $l10nFactory, protected ITimeFactory $timeFactory, - LoggerInterface $log, + protected LoggerInterface $log, ) { - $this->db = $connection; - $this->notificationManager = $notificationManager; - $this->config = $config; - $this->tokenProvider = $tokenProvider; - $this->keyManager = $keyManager; - $this->clientService = $clientService; $this->cache = $cacheFactory->createDistributed('pushtokens'); - $this->userStatusManager = $userStatusManager; - $this->l10nFactory = $l10nFactory; - $this->log = $log; } public function setOutput(OutputInterface $output): void { diff --git a/lib/Settings/AdminSection.php b/lib/Settings/AdminSection.php index 9677ffd1..a58b7b5d 100644 --- a/lib/Settings/AdminSection.php +++ b/lib/Settings/AdminSection.php @@ -14,12 +14,10 @@ use OCP\Settings\IIconSection; class AdminSection implements IIconSection { - private IL10N $l; - private IURLGenerator $url; - - public function __construct(IURLGenerator $url, IL10N $l) { - $this->url = $url; - $this->l = $l; + public function __construct( + private IURLGenerator $url, + private IL10N $l, + ) { } /** diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index 034cb651..80c1e1f6 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -23,31 +23,13 @@ use OCP\Util; class Personal implements ISettings { - /** @var \OCP\IConfig */ - protected $config; - - /** @var \OCP\IL10N */ - protected $l10n; - - /** @var SettingsMapper */ - private $settingsMapper; - - /** @var IUserSession */ - private $session; - - /** @var IInitialState */ - private $initialState; - - public function __construct(IConfig $config, - IL10N $l10n, - IUserSession $session, - SettingsMapper $settingsMapper, - IInitialState $initialState) { - $this->config = $config; - $this->l10n = $l10n; - $this->settingsMapper = $settingsMapper; - $this->session = $session; - $this->initialState = $initialState; + public function __construct( + protected IConfig $config, + protected IL10N $l10n, + protected IUserSession $session, + protected SettingsMapper $settingsMapper, + protected IInitialState $initialState, + ) { } /** diff --git a/lib/Settings/PersonalSection.php b/lib/Settings/PersonalSection.php index 7db23bdb..2fe3d391 100644 --- a/lib/Settings/PersonalSection.php +++ b/lib/Settings/PersonalSection.php @@ -14,15 +14,10 @@ use OCP\Settings\IIconSection; class PersonalSection implements IIconSection { - /** @var IL10N */ - private $l; - - /** @var IURLGenerator */ - private $url; - - public function __construct(IURLGenerator $url, IL10N $l) { - $this->url = $url; - $this->l = $l; + public function __construct( + protected IURLGenerator $url, + protected IL10N $l, + ) { } /** diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 0f254435..5359946c 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,5 +1,5 @@ - + identityProof]]> @@ -23,19 +23,15 @@ + keyManager]]> + keyManager]]> + tokenProvider]]> - - + + - - keyManager]]> - keyManager]]> - tokenProvider]]> - - - From 06a7b8bc7d70da764b9eb846d2fd183b064927cc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 2 Oct 2024 08:58:52 +0200 Subject: [PATCH 7/8] ci: Update to PHPUnit 10 Signed-off-by: Joas Schilling --- .gitignore | 1 + tests/Unit/Controller/APIControllerTest.php | 2 +- .../Controller/EndpointControllerTest.php | 126 ++-- tests/Unit/Controller/PushControllerTest.php | 2 +- tests/Unit/PushTest.php | 47 +- tests/Unit/phpunit.xml | 30 +- vendor-bin/phpunit/composer.json | 2 +- vendor-bin/phpunit/composer.lock | 587 +++++++----------- 8 files changed, 299 insertions(+), 498 deletions(-) diff --git a/.gitignore b/.gitignore index 91dd491d..5ee260a2 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ nbproject /tests/Unit/coverage* /tests/Unit/clover.xml /tests/Unit/js/node_modules +/tests/Unit/.phpunit.cache /tests/Unit/.phpunit.result.cache /.php-cs-fixer.cache diff --git a/tests/Unit/Controller/APIControllerTest.php b/tests/Unit/Controller/APIControllerTest.php index 0dff131e..2a95c420 100644 --- a/tests/Unit/Controller/APIControllerTest.php +++ b/tests/Unit/Controller/APIControllerTest.php @@ -64,7 +64,7 @@ protected function setUp(): void { ); } - public function dataGenerateNotification(): array { + public static function dataGenerateNotification(): array { return [ ['user', '', '', false, null, false, null, 123, null, Http::STATUS_NOT_FOUND], ['user', '', '', false, null, false, 'user', 123, null, Http::STATUS_BAD_REQUEST], diff --git a/tests/Unit/Controller/EndpointControllerTest.php b/tests/Unit/Controller/EndpointControllerTest.php index f30b1229..3811d2a9 100644 --- a/tests/Unit/Controller/EndpointControllerTest.php +++ b/tests/Unit/Controller/EndpointControllerTest.php @@ -94,11 +94,11 @@ protected function getController(array $methods = [], $username = 'username') { $this->clientService, $this->push, ]) - ->setMethods($methods) + ->onlyMethods($methods) ->getMock(); } - public function dataListNotifications(): array { + public static function dataListNotifications(): array { return [ [ 'v2', @@ -109,10 +109,8 @@ public function dataListNotifications(): array { [ 'v2', [ - 1 => $this->getMockBuilder(INotification::class) - ->getMock(), - 3 => $this->getMockBuilder(INotification::class) - ->getMock(), + 1, + 3, ], '"' . md5(json_encode([1, 3])) . '"', [['$notification'], ['$notification']], @@ -120,8 +118,7 @@ public function dataListNotifications(): array { [ 'v2', [ - 42 => $this->getMockBuilder(INotification::class) - ->getMock(), + 42, ], '"' . md5(json_encode([42])) . '"', [['$notification']], @@ -131,12 +128,10 @@ public function dataListNotifications(): array { /** * @dataProvider dataListNotifications - * @param string $apiVersion - * @param array $notifications - * @param string $expectedETag - * @param array $expectedData */ public function testListNotifications(string $apiVersion, array $notifications, string $expectedETag, array $expectedData): void { + $notifications = array_fill_keys($notifications, $this->createMock(INotification::class)); + $controller = $this->getController([ 'notificationToArray', ]); @@ -180,15 +175,13 @@ public function testListNotifications(string $apiVersion, array $notifications, $this->assertSame($expectedData, $response->getData()); } - public function dataListNotificationsThrows() { + public static function dataListNotificationsThrows(): array { return [ [ 'v2', [ - 1 => $this->getMockBuilder(INotification::class) - ->getMock(), - 3 => $this->getMockBuilder(INotification::class) - ->getMock(), + 1, + 3, ], '"' . md5(json_encode([3])) . '"', [['$notification']], @@ -198,12 +191,10 @@ public function dataListNotificationsThrows() { /** * @dataProvider dataListNotificationsThrows - * @param string $apiVersion - * @param array $notifications - * @param string $expectedETag - * @param array $expectedData */ - public function testListNotificationsThrows($apiVersion, array $notifications, $expectedETag, array $expectedData) { + public function testListNotificationsThrows(string $apiVersion, array $notifications, string $expectedETag, array $expectedData): void { + $notifications = array_fill_keys($notifications, $this->createMock(INotification::class)); + $controller = $this->getController([ 'notificationToArray', ]); @@ -260,7 +251,7 @@ public function testListNotificationsThrows($apiVersion, array $notifications, $ $this->assertSame($expectedData, $response->getData()); } - public function dataListNotificationsNoNotifiers() { + public static function dataListNotificationsNoNotifiers(): array { return [ ['v1'], ['v2'], @@ -271,7 +262,7 @@ public function dataListNotificationsNoNotifiers() { * @dataProvider dataListNotificationsNoNotifiers * @param string $apiVersion */ - public function testListNotificationsNoNotifiers($apiVersion) { + public function testListNotificationsNoNotifiers(string $apiVersion): void { $controller = $this->getController(); $this->manager->expects($this->once()) ->method('hasNotifiers') @@ -282,7 +273,7 @@ public function testListNotificationsNoNotifiers($apiVersion) { $this->assertSame(Http::STATUS_NO_CONTENT, $response->getStatus()); } - public function dataGetNotification() { + public static function dataGetNotification(): array { return [ ['v1', 42, 'username1', [['$notification']]], ['v2', 21, 'username2', [['$notification']]], @@ -291,11 +282,8 @@ public function dataGetNotification() { /** * @dataProvider dataGetNotification - * @param string $apiVersion - * @param int $id - * @param string $username */ - public function testGetNotification($apiVersion, $id, $username) { + public function testGetNotification(string $apiVersion, int $id, string $username): void { $controller = $this->getController([ 'notificationToArray', ], $username); @@ -331,22 +319,22 @@ public function testGetNotification($apiVersion, $id, $username) { $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - public function dataGetNotificationNoId(): array { - $notification = $this->getMockBuilder(INotification::class) - ->getMock(); - + public static function dataGetNotificationNoId(): array { return [ ['v1', false, 42, false, new NotificationNotFoundException()], // No notifiers ['v1', true, 42, true, new NotificationNotFoundException()], // Not found in database - ['v1', true, 42, true, $notification], // Not handled on prepare - ['v2', true, 42, true, $notification], // Not handled on prepare + ['v1', true, 42, true, null], // Not handled on prepare + ['v2', true, 42, true, null], // Not handled on prepare ]; } /** * @dataProvider dataGetNotificationNoId */ - public function testGetNotificationNoId(string $apiVersion, bool $hasNotifiers, int $id, bool $called, NotificationNotFoundException|INotification $notification): void { + public function testGetNotificationNoId(string $apiVersion, bool $hasNotifiers, int $id, bool $called, ?NotificationNotFoundException $notification): void { + if ($notification === null) { + $notification = $this->createMock(INotification::class); + } $controller = $this->getController(); $this->manager->expects($this->once()) @@ -381,7 +369,7 @@ public function testGetNotificationNoId(string $apiVersion, bool $hasNotifiers, $this->assertSame(Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function dataDeleteNotification() { + public static function dataDeleteNotification(): array { return [ [42, 'username1'], [21, 'username2'], @@ -390,10 +378,8 @@ public function dataDeleteNotification() { /** * @dataProvider dataDeleteNotification - * @param int $id - * @param string $username */ - public function testDeleteNotification($id, $username) { + public function testDeleteNotification(int $id, string $username): void { $controller = $this->getController([], $username); $this->handler->expects($this->once()) @@ -405,7 +391,7 @@ public function testDeleteNotification($id, $username) { $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - public function testDeleteNotificationNoId() { + public function testDeleteNotificationNoId(): void { $controller = $this->getController(); $this->handler->expects($this->never()) @@ -418,10 +404,8 @@ public function testDeleteNotificationNoId() { /** * @dataProvider dataDeleteNotification - * @param int $_ - * @param string $username */ - public function testDeleteAllNotifications($_, $username) { + public function testDeleteAllNotifications(int $_, string $username): void { $controller = $this->getController([], $username); $this->handler->expects($this->once()) @@ -438,47 +422,24 @@ public function testDeleteAllNotifications($_, $username) { $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - public function dataNotificationToArray() { + public static function dataNotificationToArray(): array { return [ - ['v1', 42, 'app1', 'user1', 1234, 'type1', '42', 'subject1', '', [], 'message1', 'richMessage 1', ['richMessage param'], 'link1', 'icon1', [], []], - ['v1', 1337, 'app2', 'user2', 1337, 'type2', '21', 'subject2', 'richSubject 2', ['richSubject param'], 'message2', '', [], 'link2', 'icon2', [ - $this->getMockBuilder(IAction::class) - ->getMock(), - $this->getMockBuilder(IAction::class) - ->getMock(), - ], [['action'], ['action']]], - ['v2', 42, 'app1', 'user1', 1234, 'type1', '42', 'subject1', '', [], 'message1', 'richMessage 1', ['richMessage param'], 'link1', 'icon1', [], []], - ['v2', 1337, 'app2', 'user2', 1337, 'type2', '21', 'subject2', 'richSubject 2', ['richSubject param'], 'message2', '', [], 'link2', 'icon2', [ - $this->getMockBuilder(IAction::class) - ->getMock(), - $this->getMockBuilder(IAction::class) - ->getMock(), - ], [['action'], ['action']]], + ['v1', 42, 'app1', 'user1', 1234, 'type1', '42', 'subject1', '', [], 'message1', 'richMessage 1', ['richMessage param'], 'link1', 'icon1', 0, []], + ['v1', 1337, 'app2', 'user2', 1337, 'type2', '21', 'subject2', 'richSubject 2', ['richSubject param'], 'message2', '', [], 'link2', 'icon2', 2, [['action'], ['action']]], + ['v2', 42, 'app1', 'user1', 1234, 'type1', '42', 'subject1', '', [], 'message1', 'richMessage 1', ['richMessage param'], 'link1', 'icon1', 0, []], + ['v2', 1337, 'app2', 'user2', 1337, 'type2', '21', 'subject2', 'richSubject 2', ['richSubject param'], 'message2', '', [], 'link2', 'icon2', 2, [['action'], ['action']]], ]; } /** * @dataProvider dataNotificationToArray - * - * @param string $apiVersion - * @param int $id - * @param string $app - * @param string $user - * @param int $timestamp - * @param string $objectType - * @param int $objectId - * @param string $subject - * @param string $subjectRich - * @param array $subjectRichParameters - * @param string $message - * @param string $messageRich - * @param array $messageRichParameters - * @param string $link - * @param string $icon - * @param array $actions - * @param array $actionsExpected */ - public function testNotificationToArray($apiVersion, $id, $app, $user, $timestamp, $objectType, $objectId, $subject, $subjectRich, $subjectRichParameters, $message, $messageRich, $messageRichParameters, $link, $icon, array $actions, array $actionsExpected) { + public function testNotificationToArray(string $apiVersion, int $id, string $app, string $user, int $timestamp, string $objectType, string $objectId, string $subject, string$subjectRich, array $subjectRichParameters, string $message, string $messageRich, array $messageRichParameters, string $link, string $icon, int $actionsCount, array $actionsExpected): void { + $actions = []; + for ($i = 0; $i < $actionsCount; $i++) { + $actions[] = $this->createMock(IAction::class); + } + $notification = $this->getMockBuilder(INotification::class) ->getMock(); @@ -575,7 +536,7 @@ public function testNotificationToArray($apiVersion, $id, $app, $user, $timestam ); } - public function dataActionToArray() { + public static function dataActionToArray(): array { return [ ['label1', 'link1', 'GET', false], ['label2', 'link2', 'POST', true], @@ -584,13 +545,8 @@ public function dataActionToArray() { /** * @dataProvider dataActionToArray - * - * @param string $label - * @param string $link - * @param string $requestType - * @param bool $isPrimary */ - public function testActionToArray($label, $link, $requestType, $isPrimary) { + public function testActionToArray(string $label, string $link, string $requestType, bool $isPrimary): void { $action = $this->getMockBuilder(IAction::class) ->getMock(); diff --git a/tests/Unit/Controller/PushControllerTest.php b/tests/Unit/Controller/PushControllerTest.php index 1720015e..5cd698b7 100644 --- a/tests/Unit/Controller/PushControllerTest.php +++ b/tests/Unit/Controller/PushControllerTest.php @@ -120,7 +120,7 @@ protected function getController(array $methods = []): PushController|MockObject $this->tokenProvider, $this->identityProof, ]) - ->setMethods($methods) + ->onlyMethods($methods) ->getMock(); } diff --git a/tests/Unit/PushTest.php b/tests/Unit/PushTest.php index e5fe6dfd..e72540d6 100644 --- a/tests/Unit/PushTest.php +++ b/tests/Unit/PushTest.php @@ -95,7 +95,7 @@ protected function getPush(array $methods = []): Push|MockObject { $this->timeFactory, $this->logger, ]) - ->setMethods($methods) + ->onlyMethods($methods) ->getMock(); } @@ -109,7 +109,8 @@ protected function getPush(array $methods = []): Push|MockObject { $this->cacheFactory, $this->userStatusManager, $this->l10nFactory, - $this->logger + $this->timeFactory, + $this->logger, ); } @@ -598,45 +599,11 @@ public function testPushToDeviceSending(bool $isDebug): void { $exception0 = new \Exception(); $client->expects($this->exactly(5)) ->method('post') - ->withConsecutive( - [ - 'proxyserver1/notifications', - [ - 'body' => [ - 'notifications' => ['["Payload"]', '["Payload"]'], - ] - ] - ], - [ - 'badrequest/notifications', - [ - 'body' => [ - 'notifications' => ['["Payload"]'], - ] - ] - ], - [ - 'unavailable/notifications', - [ - 'body' => [ - 'notifications' => ['["Payload"]'], - ] - ], - ], - [ - 'ok/notifications', - [ - 'body' => [ - 'notifications' => ['["Payload"]'], - ] - ], - ] - ) ->willReturnOnConsecutiveCalls( - $this->throwException($exception0), - $this->throwException($exception1), - $this->throwException($exception2), - $response3, + $this->throwException($exception0), // proxyserver1/notifications + $this->throwException($exception1), // badrequest/notifications + $this->throwException($exception2), // unavailable/notifications + $response3, // ok/notifications $this->throwException($exception4), ); diff --git a/tests/Unit/phpunit.xml b/tests/Unit/phpunit.xml index 349bf9d7..e7077dde 100644 --- a/tests/Unit/phpunit.xml +++ b/tests/Unit/phpunit.xml @@ -1,24 +1,18 @@ - + - - . + cacheDirectory=".phpunit.cache" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"> + + . - - - - ../../../notifications/lib - ../../../notifications/appinfo - - - - - - + + + ../../../notifications/lib + ../../../notifications/appinfo + + - diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index c3d1b761..4bdc67dd 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -6,6 +6,6 @@ "sort-packages": true }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^10.5" } } diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 1442911c..a8d5f5b6 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -4,79 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b523683a3040ceca734f58b161c7f6d6", + "content-hash": "fb78960ff7e774a72d424270c4bd3d90", "packages": [], "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "myclabs/deep-copy", "version": "1.12.0", @@ -315,16 +245,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "10.1.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", "shasum": "" }, "require": { @@ -332,18 +262,18 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -352,7 +282,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "10.1.x-dev" } }, "autoload": { @@ -381,7 +311,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" }, "funding": [ { @@ -389,32 +319,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-08-22T04:31:57+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -441,7 +371,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -449,28 +380,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -478,7 +409,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -504,7 +435,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -512,32 +443,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -563,7 +494,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -571,32 +503,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -622,7 +554,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -630,24 +562,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.21", + "version": "10.5.35", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" + "reference": "7ac8b4e63f456046dcb4c9787da9382831a1874b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", - "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7ac8b4e63f456046dcb4c9787da9382831a1874b", + "reference": "7ac8b4e63f456046dcb4c9787da9382831a1874b", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -657,27 +588,26 @@ "myclabs/deep-copy": "^1.12.0", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.2", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -685,7 +615,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "10.5-dev" } }, "autoload": { @@ -717,7 +647,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.35" }, "funding": [ { @@ -733,32 +663,32 @@ "type": "tidelift" } ], - "time": "2024-09-19T10:50:18+00:00" + "time": "2024-09-19T10:52:21+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -781,7 +711,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" }, "funding": [ { @@ -789,32 +720,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-03-02T07:12:49+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -837,7 +768,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -845,32 +776,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -892,7 +823,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -900,34 +831,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -966,7 +899,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.2" }, "funding": [ { @@ -974,33 +908,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-08-12T06:03:08+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -1023,7 +957,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -1031,33 +966,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1089,7 +1024,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -1097,27 +1033,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-03-02T07:15:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -1125,7 +1061,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -1144,7 +1080,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -1152,7 +1088,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" }, "funding": [ { @@ -1160,34 +1097,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-03-23T08:47:14+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1229,7 +1166,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" }, "funding": [ { @@ -1237,38 +1175,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-03-02T07:17:12+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1287,13 +1222,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" }, "funding": [ { @@ -1301,33 +1237,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-03-02T07:19:19+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -1350,7 +1286,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -1358,34 +1295,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1407,7 +1344,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -1415,32 +1352,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1462,7 +1399,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -1470,32 +1407,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1525,61 +1462,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -1587,32 +1470,32 @@ "type": "github" } ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1635,7 +1518,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -1643,29 +1526,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1688,7 +1571,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -1696,7 +1579,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "theseer/tokenizer", From b7b16ea304501557a9433c0beceac465faf9fc35 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 2 Oct 2024 12:18:13 +0200 Subject: [PATCH 8/8] fix(cs): Apply coding standard auto fixes Signed-off-by: Joas Schilling --- lib/MailNotifications.php | 2 +- lib/Push.php | 4 ++-- rector.php | 1 + tests/Integration/features/bootstrap/CommandLineTrait.php | 2 +- tests/Unit/Notifier/NotifierTest.php | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index 9a15ace3..59d314ad 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -62,7 +62,7 @@ public function sendEmails(int $batchSize, int $sendTime): void { return; } - $userIds = array_map(static fn(Settings $settings) => $settings->getUserId(), $userSettings); + $userIds = array_map(static fn (Settings $settings) => $settings->getUserId(), $userSettings); // Batch-read settings $fallbackTimeZone = date_default_timezone_get(); diff --git a/lib/Push.php b/lib/Push.php index e71403e1..468d5a8d 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -171,8 +171,8 @@ public function flushPayloads(): void { public function filterDeviceList(array $devices, string $app): array { $isTalkNotification = \in_array($app, ['spreed', 'talk', 'admin_notification_talk'], true); - $talkDevices = array_filter($devices, static fn($device) => $device['apptype'] === 'talk'); - $otherDevices = array_filter($devices, static fn($device) => $device['apptype'] !== 'talk'); + $talkDevices = array_filter($devices, static fn ($device) => $device['apptype'] === 'talk'); + $otherDevices = array_filter($devices, static fn ($device) => $device['apptype'] !== 'talk'); $this->printInfo('Identified ' . count($talkDevices) . ' Talk devices and ' . count($otherDevices) . ' others.'); diff --git a/rector.php b/rector.php index a960a0e5..a550530e 100644 --- a/rector.php +++ b/rector.php @@ -7,6 +7,7 @@ */ use Rector\Config\RectorConfig; + return RectorConfig::configure() ->withPaths([ __DIR__ . '/appinfo', diff --git a/tests/Integration/features/bootstrap/CommandLineTrait.php b/tests/Integration/features/bootstrap/CommandLineTrait.php index 600f96e8..27ec811f 100644 --- a/tests/Integration/features/bootstrap/CommandLineTrait.php +++ b/tests/Integration/features/bootstrap/CommandLineTrait.php @@ -42,7 +42,7 @@ public function runOcc($args = [], $env = []) { 'maintenance:mode', ], true); - $args = array_map(fn($arg) => escapeshellarg($arg), $args); + $args = array_map(fn ($arg) => escapeshellarg($arg), $args); $args[] = '--no-ansi'; $argString = implode(' ', $args); diff --git a/tests/Unit/Notifier/NotifierTest.php b/tests/Unit/Notifier/NotifierTest.php index 9610821d..b3b7bc8b 100644 --- a/tests/Unit/Notifier/NotifierTest.php +++ b/tests/Unit/Notifier/NotifierTest.php @@ -34,7 +34,7 @@ protected function setUp(): void { $this->l = $this->createMock(IL10N::class); $this->l->expects($this->any()) ->method('t') - ->willReturnCallback(fn($string, $args) => vsprintf($string, $args)); + ->willReturnCallback(fn ($string, $args) => vsprintf($string, $args)); $this->factory = $this->createMock(IFactory::class); $this->factory->expects($this->any()) ->method('get')