aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-05-11 13:02:04 +0200
committerGravatar GitHub <noreply@github.com> 2023-05-11 13:02:04 +0200
commit6e2f2f1c1e98ecd86aa89c6547beb742d7385d18 (patch)
tree7ba9f5aebb01d12045b9067a86b5060ba13dca18 /app/Models/Feed.php
parentfe7d9bbcd68660a59b813346c236b61b25a51c80 (diff)
A few additional PHPStan rules (#5388)
A subset of https://github.com/phpstan/phpstan-strict-rules
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index f833b2834..b418d2641 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -504,7 +504,7 @@ class FreshRSS_Feed extends Minz_Model {
$text = html_only_entity_decode($category->get_label());
//Some feeds use a single category with comma-separated tags
$labels = explode(',', $text);
- if (is_array($labels)) {
+ if (!empty($labels)) {
foreach ($labels as $label) {
$tags[] = trim($label);
}
@@ -892,7 +892,7 @@ class FreshRSS_Feed extends Minz_Model {
*/
public function _filtersAction(string $action, array $filters): void {
$action = trim($action);
- if ($action == '' || !is_array($filters)) {
+ if ($action == '') {
return;
}
$filters = array_unique(array_map('trim', $filters));
@@ -969,8 +969,8 @@ class FreshRSS_Feed extends Minz_Model {
$hubFilename = PSHB_PATH . '/feeds/' . sha1($url) . '/!hub.json';
$hubFile = @file_get_contents($hubFilename);
$hubJson = $hubFile ? json_decode($hubFile, true) : array();
- if (!isset($hubJson['error']) || $hubJson['error'] !== (bool)$error) {
- $hubJson['error'] = (bool)$error;
+ if (!isset($hubJson['error']) || $hubJson['error'] !== $error) {
+ $hubJson['error'] = $error;
file_put_contents($hubFilename, json_encode($hubJson));
Minz_Log::warning('Set error to ' . ($error ? 1 : 0) . ' for ' . $url, PSHB_LOG);
}