diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2022-04-14 10:12:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 10:12:32 +0300 |
commit | 5bfb980a1e26919cd9b60533411434d5380e9430 (patch) | |
tree | da57cb2cd60ad38840dd4b551d3df16631425a34 | |
parent | 176aad1df9eb1f3e78d14c0484ef4e06bebd4239 (diff) | |
parent | 8c4bf0171b8d4963233fe26f9df0c4e2003cadbf (diff) |
Merge pull request #272 from J0WI/strict_types
-rw-r--r-- | appinfo/routes.php | 3 | ||||
-rw-r--r-- | lib/Controller/IPWhitelistController.php | 11 | ||||
-rw-r--r-- | lib/Settings/IPWhitelist.php | 9 |
3 files changed, 16 insertions, 7 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 28ab6e9..e49b9af 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl> * diff --git a/lib/Controller/IPWhitelistController.php b/lib/Controller/IPWhitelistController.php index 815295f..34cfcb3 100644 --- a/lib/Controller/IPWhitelistController.php +++ b/lib/Controller/IPWhitelistController.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl> * @@ -41,7 +44,7 @@ class IPWhitelistController extends Controller { * @param IRequest $request * @param IConfig $config */ - public function __construct($appName, + public function __construct(string $appName, IRequest $request, IConfig $config) { parent::__construct($appName, $request); @@ -52,7 +55,7 @@ class IPWhitelistController extends Controller { /** * @return JSONResponse */ - public function getAll() { + public function getAll(): JSONResponse { $keys = $this->config->getAppKeys('bruteForce'); $keys = array_filter($keys, function ($key) { $regex = '/^whitelist_/S'; @@ -80,7 +83,7 @@ class IPWhitelistController extends Controller { * @param int $mask * @return JSONResponse */ - public function add($ip, $mask) { + public function add(string $ip, int $mask): JSONResponse { if (!filter_var($ip, FILTER_VALIDATE_IP) || (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && ($mask < 0 || $mask > 32)) || (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && ($mask < 0 || $mask > 128))) { @@ -115,7 +118,7 @@ class IPWhitelistController extends Controller { * @param int $id * @return JSONResponse */ - public function remove($id) { + public function remove(int $id): JSONResponse { $this->config->deleteAppValue('bruteForce', 'whitelist_'.$id); return new JSONResponse([]); diff --git a/lib/Settings/IPWhitelist.php b/lib/Settings/IPWhitelist.php index 0dcc833..b15d58c 100644 --- a/lib/Settings/IPWhitelist.php +++ b/lib/Settings/IPWhitelist.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl> * @@ -27,15 +30,15 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\Settings\ISettings; class IPWhitelist implements ISettings { - public function getForm() { + public function getForm(): TemplateResponse { return new TemplateResponse('bruteforcesettings', 'ipwhitelist'); } - public function getSection() { + public function getSection(): string { return 'security'; } - public function getPriority() { + public function getPriority(): int { return 50; } } |