diff options
author | Joas Schilling <coding@schilljs.com> | 2021-04-15 22:07:11 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-04-15 22:26:39 +0300 |
commit | cbfee7b4444a4e3921d78f2cff7a181f7ef5f709 (patch) | |
tree | ebdd33426e9f1045d6ed494a8b14a8223c68487c /lib | |
parent | 2d86327752d34f0b4c26826d77e1dffc31daa296 (diff) |
Make everything strict
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/App.php | 6 | ||||
-rw-r--r-- | lib/Capabilities.php | 3 | ||||
-rw-r--r-- | lib/Command/Generate.php | 14 | ||||
-rw-r--r-- | lib/Command/TestPush.php | 5 | ||||
-rw-r--r-- | lib/Controller/EndpointController.php | 3 | ||||
-rw-r--r-- | lib/Controller/PushController.php | 20 | ||||
-rw-r--r-- | lib/Exceptions/NotificationNotFoundException.php | 4 | ||||
-rw-r--r-- | lib/Handler.php | 10 | ||||
-rw-r--r-- | lib/Listener/UserDeletedListener.php | 3 | ||||
-rw-r--r-- | lib/Migration/Version2004Date20190107135757.php | 2 | ||||
-rw-r--r-- | lib/Migration/Version2010Date20210218082811.php | 2 | ||||
-rw-r--r-- | lib/Notifier/AdminNotifications.php | 10 | ||||
-rw-r--r-- | lib/Push.php | 7 |
13 files changed, 55 insertions, 34 deletions
diff --git a/lib/App.php b/lib/App.php index a7cfcc0..513a57d 100644 --- a/lib/App.php +++ b/lib/App.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @author Joas Schilling <coding@schilljs.com> * @@ -32,7 +35,8 @@ class App implements IDeferrableApp { /** @var Push */ protected $push; - public function __construct(Handler $handler, Push $push) { + public function __construct(Handler $handler, + Push $push) { $this->handler = $handler; $this->push = $push; } diff --git a/lib/Capabilities.php b/lib/Capabilities.php index a46456a..c2c5cb0 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @author Joas Schilling <coding@schilljs.com> * diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php index 20155d0..223da86 100644 --- a/lib/Command/Generate.php +++ b/lib/Command/Generate.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> * @@ -44,12 +47,9 @@ class Generate extends Command { /** @var IManager */ protected $notificationManager; - /** - * @param ITimeFactory $timeFactory - * @param IUserManager $userManager - * @param IManager $notificationManager - */ - public function __construct(ITimeFactory $timeFactory, IUserManager $userManager, IManager $notificationManager) { + public function __construct(ITimeFactory $timeFactory, + IUserManager $userManager, + IManager $notificationManager) { parent::__construct(); $this->timeFactory = $timeFactory; @@ -57,7 +57,7 @@ class Generate extends Command { $this->notificationManager = $notificationManager; } - protected function configure() { + protected function configure(): void { $this ->setName('notification:generate') ->setDescription('Generate a notification for the given user') diff --git a/lib/Command/TestPush.php b/lib/Command/TestPush.php index 191bcc4..11ca7eb 100644 --- a/lib/Command/TestPush.php +++ b/lib/Command/TestPush.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> * @@ -58,7 +61,7 @@ class TestPush extends Command { $this->app = $app; } - protected function configure() { + protected function configure(): void { $this ->setName('notification:test-push') ->setDescription('Generate a notification for the given user') diff --git a/lib/Controller/EndpointController.php b/lib/Controller/EndpointController.php index 8048e9e..2cf0fc5 100644 --- a/lib/Controller/EndpointController.php +++ b/lib/Controller/EndpointController.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @author Joas Schilling <coding@schilljs.com> * diff --git a/lib/Controller/PushController.php b/lib/Controller/PushController.php index 5c69084..a0417de 100644 --- a/lib/Controller/PushController.php +++ b/lib/Controller/PushController.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> * @@ -52,16 +55,13 @@ class PushController extends OCSController { /** @var Manager */ private $identityProof; - /** - * @param string $appName - * @param IRequest $request - * @param IDBConnection $db - * @param ISession $session - * @param IUserSession $userSession - * @param IProvider $tokenProvider - * @param Manager $identityProof - */ - public function __construct($appName, IRequest $request, IDBConnection $db, ISession $session, IUserSession $userSession, IProvider $tokenProvider, Manager $identityProof) { + public function __construct(string $appName, + IRequest $request, + IDBConnection $db, + ISession $session, + IUserSession $userSession, + IProvider $tokenProvider, + Manager $identityProof) { parent::__construct($appName, $request); $this->db = $db; diff --git a/lib/Exceptions/NotificationNotFoundException.php b/lib/Exceptions/NotificationNotFoundException.php index 75d300f..a024907 100644 --- a/lib/Exceptions/NotificationNotFoundException.php +++ b/lib/Exceptions/NotificationNotFoundException.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2018, Joas Schilling <coding@schilljs.com> * @@ -21,7 +24,6 @@ * */ - namespace OCA\Notifications\Exceptions; class NotificationNotFoundException extends \OutOfBoundsException { diff --git a/lib/Handler.php b/lib/Handler.php index cd505f6..f04960a 100644 --- a/lib/Handler.php +++ b/lib/Handler.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @author Joas Schilling <coding@schilljs.com> * @@ -35,11 +38,8 @@ class Handler { /** @var IManager */ protected $manager; - /** - * @param IDBConnection $connection - * @param IManager $manager - */ - public function __construct(IDBConnection $connection, IManager $manager) { + public function __construct(IDBConnection $connection, + IManager $manager) { $this->connection = $connection; $this->manager = $manager; } diff --git a/lib/Listener/UserDeletedListener.php b/lib/Listener/UserDeletedListener.php index 714da61..11e049e 100644 --- a/lib/Listener/UserDeletedListener.php +++ b/lib/Listener/UserDeletedListener.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2020 Daniel Kesselberg <mail@danielkesselberg.de> * diff --git a/lib/Migration/Version2004Date20190107135757.php b/lib/Migration/Version2004Date20190107135757.php index 06f22f4..2e540aa 100644 --- a/lib/Migration/Version2004Date20190107135757.php +++ b/lib/Migration/Version2004Date20190107135757.php @@ -24,8 +24,8 @@ declare(strict_types=1); namespace OCA\Notifications\Migration; use Closure; -use Doctrine\DBAL\Types\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; diff --git a/lib/Migration/Version2010Date20210218082811.php b/lib/Migration/Version2010Date20210218082811.php index 9efbee7..5baf50e 100644 --- a/lib/Migration/Version2010Date20210218082811.php +++ b/lib/Migration/Version2010Date20210218082811.php @@ -25,9 +25,9 @@ declare(strict_types=1); namespace OCA\Notifications\Migration; use Closure; -use Doctrine\DBAL\Types\Types; use OCP\DB\ISchemaWrapper; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\DB\Types; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/lib/Notifier/AdminNotifications.php b/lib/Notifier/AdminNotifications.php index e35a396..5227c0b 100644 --- a/lib/Notifier/AdminNotifications.php +++ b/lib/Notifier/AdminNotifications.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> * @@ -37,11 +40,8 @@ class AdminNotifications implements INotifier { /** @var IURLGenerator */ protected $urlGenerator; - /** - * @param IFactory $l10nFactory - * @param IURLGenerator $urlGenerator - */ - public function __construct(IFactory $l10nFactory, IURLGenerator $urlGenerator) { + public function __construct(IFactory $l10nFactory, + IURLGenerator $urlGenerator) { $this->l10nFactory = $l10nFactory; $this->urlGenerator = $urlGenerator; } diff --git a/lib/Push.php b/lib/Push.php index 7ac110a..f9009c3 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> * @@ -333,7 +336,7 @@ class Push { $this->printInfo('Push notification sent successfully'); } } elseif ($status !== Http::STATUS_OK) { - $error = \is_string($body) && $bodyData === null ? $body : 'no reason given'; + $error = \is_string($body) && $body && $bodyData === null ? $body : 'no reason given'; $this->printInfo('Could not send notification to push server [' . $proxyServer . ']: ' . $error); $this->log->warning('Could not send notification to push server [{url}]: {error}', [ 'error' => $error, @@ -341,7 +344,7 @@ class Push { 'app' => 'notifications', ]); } else { - $error = \is_string($body) && $bodyData === null ? $body : 'no reason given'; + $error = \is_string($body) && $body && $bodyData === null ? $body : 'no reason given'; $this->printInfo('Push notification sent but response was not parsable, using an outdated push proxy? [' . $proxyServer . ']: ' . $error); $this->log->info('Push notification sent but response was not parsable, using an outdated push proxy? [{url}]: {error}', [ 'error' => $error, |