diff options
| author | 2024-09-11 17:14:53 +0200 | |
|---|---|---|
| committer | 2024-09-11 17:14:53 +0200 | |
| commit | dfac9f5813df7d4c7c812c381364c8898333f559 (patch) | |
| tree | 978496d0a8d8b0d6b5dbe836c6829296133b337c /app/Models/Feed.php | |
| parent | 31c8846791d4b5316fbc790202f79545c012f9c2 (diff) | |
PHPStan booleansInConditions (#6793)
* PHPStan booleansInConditions
* Uniformisation
Diffstat (limited to 'app/Models/Feed.php')
| -rw-r--r-- | app/Models/Feed.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 6e468e33f..37f1d8cd4 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -371,7 +371,7 @@ class FreshRSS_Feed extends Minz_Model { Minz_ExtensionManager::callHook('simplepie_before_init', $simplePie, $this); $mtime = $simplePie->init(); - if ((!$mtime) || $simplePie->error()) { + if ((!$mtime) || !empty($simplePie->error())) { $errorMessage = $simplePie->error(); if (empty($errorMessage)) { $errorMessage = ''; @@ -950,7 +950,7 @@ class FreshRSS_Feed extends Minz_Model { public function pubSubHubbubEnabled(): bool { $url = $this->selfUrl ?: $this->url; $hubFilename = PSHB_PATH . '/feeds/' . sha1($url) . '/!hub.json'; - if ($hubFile = @file_get_contents($hubFilename)) { + if (($hubFile = @file_get_contents($hubFilename)) != false) { $hubJson = json_decode($hubFile, true); if (is_array($hubJson) && empty($hubJson['error']) && (empty($hubJson['lease_end']) || $hubJson['lease_end'] > time())) { @@ -976,10 +976,10 @@ class FreshRSS_Feed extends Minz_Model { public function pubSubHubbubPrepare(): string|false { $key = ''; if (Minz_Request::serverIsPublic(FreshRSS_Context::systemConf()->base_url) && - $this->hubUrl && $this->selfUrl && @is_dir(PSHB_PATH)) { + $this->hubUrl !== '' && $this->selfUrl !== '' && @is_dir(PSHB_PATH)) { $path = PSHB_PATH . '/feeds/' . sha1($this->selfUrl); $hubFilename = $path . '/!hub.json'; - if ($hubFile = @file_get_contents($hubFilename)) { + if (($hubFile = @file_get_contents($hubFilename)) != false) { $hubJson = json_decode($hubFile, true); if (!is_array($hubJson) || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { $text = 'Invalid JSON for WebSub: ' . $this->url; @@ -1027,7 +1027,7 @@ class FreshRSS_Feed extends Minz_Model { } else { $url = $this->url; //Always use current URL during unsubscribe } - if ($url && (Minz_Request::serverIsPublic(FreshRSS_Context::systemConf()->base_url) || !$state)) { + if ($url !== '' && (Minz_Request::serverIsPublic(FreshRSS_Context::systemConf()->base_url) || !$state)) { $hubFilename = PSHB_PATH . '/feeds/' . sha1($url) . '/!hub.json'; $hubFile = @file_get_contents($hubFilename); if ($hubFile === false) { |
