aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-11-16 22:43:00 +0100
committerGravatar GitHub <noreply@github.com> 2023-11-16 22:43:00 +0100
commit30c7a61a9b410f023c56ef19b9389a61647d8768 (patch)
treebb58408980ce5b86f1d2b4a9be29d55b2d46dbb1 /app/Controllers
parentee99e7e2cc228500efc1b539954c0ca6cd4c146d (diff)
Use strict_types (#5830)
* Little's optimisations and booleans in conditions * Apply strict type * Apply strict type * Apply strict type * Fix multiple bugs with PHP 8.2 and 8.3 * Many declares missing, more errors fixed * Apply strict type * Another approach * Stronger typing for Minz_Session * Fix case of SQLite --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers')
-rw-r--r--app/Controllers/apiController.php1
-rw-r--r--app/Controllers/authController.php5
-rw-r--r--app/Controllers/categoryController.php1
-rw-r--r--app/Controllers/configureController.php1
-rw-r--r--app/Controllers/entryController.php1
-rw-r--r--app/Controllers/errorController.php6
-rw-r--r--app/Controllers/extensionController.php1
-rw-r--r--app/Controllers/feedController.php1
-rw-r--r--app/Controllers/importExportController.php1
-rw-r--r--app/Controllers/indexController.php1
-rw-r--r--app/Controllers/javascriptController.php1
-rw-r--r--app/Controllers/statsController.php1
-rw-r--r--app/Controllers/subscriptionController.php1
-rw-r--r--app/Controllers/tagController.php1
-rw-r--r--app/Controllers/updateController.php1
-rw-r--r--app/Controllers/userController.php3
16 files changed, 22 insertions, 5 deletions
diff --git a/app/Controllers/apiController.php b/app/Controllers/apiController.php
index 52ec53045..7568f9831 100644
--- a/app/Controllers/apiController.php
+++ b/app/Controllers/apiController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This controller manage API-related features.
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php
index 90c9a9e03..73a640748 100644
--- a/app/Controllers/authController.php
+++ b/app/Controllers/authController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This controller handles action about authentication.
@@ -116,11 +117,11 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
$limits = FreshRSS_Context::$system_conf->limits;
$this->view->cookie_days = (int)round($limits['cookie_duration'] / 86400, 1);
- $isPOST = Minz_Request::isPost() && !Minz_Session::param('POST_to_GET');
+ $isPOST = Minz_Request::isPost() && !Minz_Session::paramBoolean('POST_to_GET');
Minz_Session::_param('POST_to_GET');
if ($isPOST) {
- $nonce = Minz_Session::param('nonce', '');
+ $nonce = Minz_Session::paramString('nonce');
$username = Minz_Request::paramString('username');
$challenge = Minz_Request::paramString('challenge');
diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php
index 630399bf4..de6399e27 100644
--- a/app/Controllers/categoryController.php
+++ b/app/Controllers/categoryController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle actions relative to categories.
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index dab653ac9..ffba5186f 100644
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every configuration options.
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
index b62214970..1ce490ea1 100644
--- a/app/Controllers/entryController.php
+++ b/app/Controllers/entryController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every entry actions.
diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php
index fe56b13eb..c3e832cf8 100644
--- a/app/Controllers/errorController.php
+++ b/app/Controllers/errorController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle error page.
@@ -14,8 +15,9 @@ class FreshRSS_error_Controller extends FreshRSS_ActionController {
* - error_logs (default: array())
*/
public function indexAction(): void {
- $code_int = Minz_Session::param('error_code', 404);
- $error_logs = Minz_Session::param('error_logs', []);
+ $code_int = Minz_Session::paramInt('error_code') ?: 404;
+ /** @var array<string> */
+ $error_logs = Minz_Session::paramArray('error_logs');
Minz_Session::_params([
'error_code' => false,
'error_logs' => false,
diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php
index e93ec778f..0158b2f76 100644
--- a/app/Controllers/extensionController.php
+++ b/app/Controllers/extensionController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The controller to manage extensions.
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index a9cb51416..933f82216 100644
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every feed actions.
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index 8f611bc78..6d37cc465 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every import and export actions.
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index cad2e9f85..a1c25e649 100644
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This class handles main actions of FreshRSS.
diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php
index eea8fc233..5d402fa67 100644
--- a/app/Controllers/javascriptController.php
+++ b/app/Controllers/javascriptController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_javascript_Controller extends FreshRSS_ActionController {
diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php
index bb99bc601..6e6a2720f 100644
--- a/app/Controllers/statsController.php
+++ b/app/Controllers/statsController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle application statistics.
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index 86083ceb0..5566224ef 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle subscription actions.
diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php
index 1a7c81841..13909d522 100644
--- a/app/Controllers/tagController.php
+++ b/app/Controllers/tagController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every tag actions.
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index 6d9249771..43860a50c 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_update_Controller extends FreshRSS_ActionController {
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index aa5682e26..6766182c1 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle user actions.
@@ -536,7 +537,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
$ok = true;
if ($self_deletion) {
// We check the password if it’s a self-destruction
- $nonce = Minz_Session::param('nonce', '');
+ $nonce = Minz_Session::paramString('nonce');
$challenge = Minz_Request::paramString('challenge');
$ok &= FreshRSS_FormAuth::checkCredentials(