From 4cc3374f9f6cdd6ea05d4d16942d0165d8b2ed90 Mon Sep 17 00:00:00 2001 From: wn_ Date: Wed, 10 Nov 2021 21:38:25 +0000 Subject: Initial go at PHPStan rule level 6. --- update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'update.php') diff --git a/update.php b/update.php index b10dde400..36c66b06c 100755 --- a/update.php +++ b/update.php @@ -12,7 +12,7 @@ Config::sanity_check(); - function make_stampfile($filename) { + function make_stampfile(string $filename): bool { $fp = fopen(Config::get(Config::LOCK_DIRECTORY) . "/$filename", "w"); if (flock($fp, LOCK_EX | LOCK_NB)) { @@ -25,7 +25,7 @@ } } - function cleanup_tags($days = 14, $limit = 1000) { + function cleanup_tags(int $days = 14, int $limit = 1000): int { $days = (int) $days; -- cgit v1.2.3 From 3f8aaffd3499cd49912c3e2cb663d8572a96851e Mon Sep 17 00:00:00 2001 From: wn_ Date: Thu, 11 Nov 2021 18:53:52 +0000 Subject: Address PHPStan warnings in 'classes/rssutils.php'. This also includes a minor tweak in 'update.php' to account for 'getopt()' potentially returning false (indicating failure). --- update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'update.php') diff --git a/update.php b/update.php index 36c66b06c..6cd61a451 100755 --- a/update.php +++ b/update.php @@ -108,7 +108,7 @@ $options = getopt("", array_keys($options_map)); - if (count($options) == 0 || isset($options["help"]) ) { + if ($options === false || count($options) == 0 || isset($options["help"]) ) { print "Tiny Tiny RSS CLI management tool\n"; print "=================================\n"; print "Options:\n\n"; -- cgit v1.2.3 From 734be4ebd1dd7732d413bb69df33ac4e33460a5e Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 12 Nov 2021 04:51:35 +0000 Subject: Minor PHPStand warning fix in 'update.php'. --- update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'update.php') diff --git a/update.php b/update.php index 6cd61a451..d62825b98 100755 --- a/update.php +++ b/update.php @@ -97,7 +97,7 @@ ]; foreach (PluginHost::getInstance()->get_commands() as $command => $data) { - $options_map[$command . $data["suffix"]] = [ $data["arghelp"] ?? "", $data["description"] ]; + $options_map[$command . $data["suffix"]] = [ $data["arghelp"], $data["description"] ]; } if (php_sapi_name() != "cli") { -- cgit v1.2.3 From c3ffa08807df4a83cd476aca79fc96217acc6c3a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 14 Nov 2021 16:15:31 +0300 Subject: deal with phpstan warnings in update.php --- update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'update.php') diff --git a/update.php b/update.php index d62825b98..90251c2f3 100755 --- a/update.php +++ b/update.php @@ -378,7 +378,7 @@ Debug::log("Exporting feeds of user $user to $filename as OPML..."); if ($owner_uid = UserHelper::find_user_by_login($user)) { - $opml = new OPML(""); + $opml = new OPML([]); $rc = $opml->opml_export($filename, $owner_uid, false, true, true); @@ -394,7 +394,7 @@ Debug::log("Importing feeds of user $user from OPML file $filename..."); if ($owner_uid = UserHelper::find_user_by_login($user)) { - $opml = new OPML(""); + $opml = new OPML([]); $rc = $opml->opml_import($owner_uid, $filename); -- cgit v1.2.3