diff options
| author | 2024-01-15 10:36:30 +0100 | |
|---|---|---|
| committer | 2024-01-15 10:36:30 +0100 | |
| commit | 314077a457f04cc2f0472e036af029e2676fbf02 (patch) | |
| tree | 1f38bb78761a56b8ee2034caba0dbda3912ef7c1 /lib/lib_rss.php | |
| parent | 52f6c8399b41e0c8be49dd56c89f451843189791 (diff) | |
PHPStan prepare exceptions (#6037)
Take advantage of
https://phpstan.org/blog/bring-your-exceptions-under-control
Minimum changes to pass `tooWideThrowType` and `implicitThrows`.
Revert some mistakes from:
https://github.com/FreshRSS/FreshRSS/pull/5504
Preparation needed before new PRs of the same type:
https://github.com/FreshRSS/FreshRSS/pull/5962
Fix several wrong PHPDocs and catches:
> Method ... has ...Exception in PHPDoc @throws tag but it's not thrown.
> Dead catch - ...Exception is never thrown in the try block.
Diffstat (limited to 'lib/lib_rss.php')
| -rw-r--r-- | lib/lib_rss.php | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index fa02c50eb..62fe87375 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -580,6 +580,7 @@ function max_registrations_reached(): bool { * * @param string $username the name of the user of which we want the configuration. * @return FreshRSS_UserConfiguration|null object, or null if the configuration cannot be loaded. + * @throws Minz_ConfigurationNamespaceException */ function get_user_configuration(string $username): ?FreshRSS_UserConfiguration { if (!FreshRSS_user_Controller::checkUsername($username)) { @@ -590,9 +591,6 @@ function get_user_configuration(string $username): ?FreshRSS_UserConfiguration { FreshRSS_UserConfiguration::register($namespace, USERS_PATH . '/' . $username . '/config.php', FRESHRSS_PATH . '/config-user.default.php'); - } catch (Minz_ConfigurationNamespaceException $e) { - // namespace already exists, do nothing. - Minz_Log::warning($e->getMessage(), ADMIN_LOG); } catch (Minz_FileNotExistException $e) { Minz_Log::warning($e->getMessage(), ADMIN_LOG); return null; @@ -706,13 +704,8 @@ function httpAuthUser(bool $onlyTrusted = true): string { } function cryptAvailable(): bool { - try { - $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; - return $hash === @crypt('password', $hash); - } catch (Exception $e) { - Minz_Log::warning($e->getMessage()); - } - return false; + $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; + return $hash === @crypt('password', $hash); } |
