aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-09-11 17:14:53 +0200
committerGravatar GitHub <noreply@github.com> 2024-09-11 17:14:53 +0200
commitdfac9f5813df7d4c7c812c381364c8898333f559 (patch)
tree978496d0a8d8b0d6b5dbe836c6829296133b337c /app/Controllers
parent31c8846791d4b5316fbc790202f79545c012f9c2 (diff)
PHPStan booleansInConditions (#6793)
* PHPStan booleansInConditions * Uniformisation
Diffstat (limited to 'app/Controllers')
-rw-r--r--app/Controllers/feedController.php14
-rw-r--r--app/Controllers/importExportController.php4
-rw-r--r--app/Controllers/subscriptionController.php2
-rw-r--r--app/Controllers/tagController.php2
4 files changed, 11 insertions, 11 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 42639f5e1..3f4ed3149 100644
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -92,7 +92,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
$feedDAO = FreshRSS_Factory::createFeedDao();
- if ($feedDAO->searchByUrl($feed->url())) {
+ if ($feedDAO->searchByUrl($feed->url()) !== null) {
throw new FreshRSS_AlreadySubscribed_Exception($url, $feed->name());
}
@@ -340,7 +340,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
$feed = $feedDAO->searchByUrl($this->view->feed->url());
- if ($feed) {
+ if ($feed !== null) {
// Already subscribe so we redirect to the feed configuration page.
$url_redirect['a'] = 'feed';
$url_redirect['params']['id'] = $feed->id();
@@ -617,7 +617,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$needFeedCacheRefresh = true;
- if ($pubSubHubbubEnabled && !$simplePiePush) { //We use push, but have discovered an article by pull!
+ if ($pubSubHubbubEnabled && $simplePiePush === null) { //We use push, but have discovered an article by pull!
$text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' .
SimplePie_Misc::url_remove_credentials($url) .
' GUID ' . $entry->guid();
@@ -658,10 +658,10 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$feedProperties = [];
- if ($pubsubhubbubEnabledGeneral && $feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for WebSub
+ if ($pubsubhubbubEnabledGeneral && $feed->hubUrl() !== '' && $feed->selfUrl() !== '') { //selfUrl has priority for WebSub
if ($feed->selfUrl() !== $url) { // https://github.com/pubsubhubbub/PubSubHubbub/wiki/Moving-Feeds-or-changing-Hubs
$selfUrl = checkUrl($feed->selfUrl());
- if ($selfUrl) {
+ if ($selfUrl != false) {
Minz_Log::debug('WebSub unsubscribe ' . $feed->url(false));
if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe
Minz_Log::warning('Error while WebSub unsubscribing from ' . $feed->url(false));
@@ -709,7 +709,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
$feed->faviconPrepare();
- if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) {
+ if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare() != false) {
Minz_Log::notice('WebSub subscribe ' . $feed->url(false));
if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe
Minz_Log::warning('Error while WebSub subscribing to ' . $feed->url(false));
@@ -997,7 +997,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
break;
case 'normal':
$get = Minz_Request::paramString('get');
- if ($get) {
+ if ($get !== '') {
$redirect_url = ['c' => 'index', 'a' => 'normal', 'params' => ['get' => $get]];
} else {
$redirect_url = ['c' => 'index', 'a' => 'normal'];
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index 62f7721ab..50c2037fe 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -351,7 +351,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
}
}
- if ($feed != null) {
+ if ($feed !== null) {
$article_to_feed[$item['guid']] = $feed->id();
if (!isset($newFeedGuids['f_' . $feed->id()])) {
$newFeedGuids['f_' . $feed->id()] = [];
@@ -627,7 +627,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
foreach ($export_feeds as $feed_id) {
$result = $export_service->generateFeedEntries((int)$feed_id, $max_number_entries);
- if (!$result) {
+ if ($result === null) {
// It means the actual feed_id doesn’t correspond to any existing feed
continue;
}
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index af18bbced..fe228829a 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -304,7 +304,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
case 'normal':
case 'reader':
$get = Minz_Request::paramString('get');
- if ($get) {
+ if ($get !== '') {
$url_redirect = ['c' => 'index', 'a' => $from, 'params' => ['get' => $get]];
} else {
$url_redirect = ['c' => 'index', 'a' => $from];
diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php
index 02bb930ee..2bc7c0e1f 100644
--- a/app/Controllers/tagController.php
+++ b/app/Controllers/tagController.php
@@ -40,7 +40,7 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController {
if ($id_entry != '') {
$tagDAO = FreshRSS_Factory::createTagDao();
if ($id_tag == 0 && $name_tag !== '' && $checked) {
- if ($existing_tag = $tagDAO->searchByName($name_tag)) {
+ if (($existing_tag = $tagDAO->searchByName($name_tag)) !== null) {
// Use existing tag
$tagDAO->tagEntry($existing_tag->id(), $id_entry, $checked);
} else {