From 288ed04ccc30b58373576dc3be811aee43e67034 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 31 Mar 2023 08:23:39 +0200 Subject: PHPStan level 6 for all PDO and Exception classes (#5239) * PHPStan level 6 for all PDO and Exception classes Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112 * Fix type * Now also our remaining own librairies * Motivation for a few more files * A few more DAO classes * Last interface --- app/Models/UserDAO.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'app/Models/UserDAO.php') diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 9f91df80e..8ba50cc29 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -1,7 +1,8 @@ pdo->dbType() . '.php'); try { @@ -21,7 +22,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } } - public function deleteUser() { + public function deleteUser(): bool { if (defined('STDERR')) { fwrite(STDERR, 'Deleting SQL data for user “' . $this->current_user . "”…\n"); } @@ -38,18 +39,18 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } } - public static function exists($username) { + public static function exists(string $username): bool { return is_dir(USERS_PATH . '/' . $username); } - public static function touch($username = '') { + public static function touch(string $username = ''): bool { if (!FreshRSS_user_Controller::checkUsername($username)) { $username = Minz_User::name() ?? Minz_User::INTERNAL_USER; } return touch(USERS_PATH . '/' . $username . '/config.php'); } - public static function mtime($username) { - return @filemtime(USERS_PATH . '/' . $username . '/config.php'); + public static function mtime(string $username): int { + return @(int)filemtime(USERS_PATH . '/' . $username . '/config.php'); } } -- cgit v1.2.3