aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-02-07 00:56:45 +0100
committerGravatar GitHub <noreply@github.com> 2022-02-07 00:56:45 +0100
commit7c2da31418d3479b60c9c6b28cc595deda93d434 (patch)
treec8f0f3481e9a32aea5243f74cf86313ef57f9ec1 /app/Models
parentdfee46792f91cc357f697f35e7429c0c196f6a16 (diff)
More PHP type hints for Fever (#4202)
* More PHP type hints for Fever Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201 Related to https://github.com/FreshRSS/FreshRSS/issues/4200
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/EntryDAO.php31
-rw-r--r--app/Models/EntryDAOSQLite.php14
2 files changed, 28 insertions, 17 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index c690518b6..a10440edb 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -83,7 +83,10 @@ SQL;
return false;
}
- private $addEntryPrepared = null;
+ /**
+ * @var PDOStatement|null|false
+ */
+ private $addEntryPrepared = false;
public function addEntry(array $valuesTmp, bool $useTmpTable = true) {
if ($this->addEntryPrepared == null) {
@@ -178,7 +181,7 @@ SQL;
private $updateEntryPrepared = null;
- public function updateEntry($valuesTmp) {
+ public function updateEntry(array $valuesTmp) {
if (!isset($valuesTmp['is_read'])) {
$valuesTmp['is_read'] = null;
}
@@ -343,7 +346,7 @@ SQL;
* @param boolean $is_read
* @return integer|false affected rows
*/
- public function markRead($ids, $is_read = true) {
+ public function markRead($ids, bool $is_read = true) {
FreshRSS_UserDAO::touch();
if (is_array($ids)) { //Many IDs at once
if (count($ids) < 6) { //Speed heuristics
@@ -411,12 +414,13 @@ SQL;
* place. It will be reused also for the filtering making every thing
* separated.
*
- * @param integer $idMax fail safe article ID
+ * @param string $idMax fail safe article ID
* @param boolean $onlyFavorites
* @param integer $priorityMin
+ * @param FreshRSS_BooleanSearch|null $filters
* @return integer|false affected rows
*/
- public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filters = null, $state = 0, $is_read = true) {
+ public function markReadEntries(string $idMax = '0', bool $onlyFavorites = false, int $priorityMin = 0, $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
if ($idMax == 0) {
$idMax = time() . '000000';
@@ -456,12 +460,13 @@ SQL;
* If $idMax equals 0, a deprecated debug message is logged
*
* @param integer $id category ID
- * @param integer $idMax fail safe article ID
+ * @param string $idMax fail safe article ID
+ * @param FreshRSS_BooleanSearch|null $filters
* @return integer|false affected rows
*/
- public function markReadCat($id, $idMax = 0, $filters = null, $state = 0, $is_read = true) {
+ public function markReadCat(int $id, string $idMax = '0', $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
- if ($idMax == 0) {
+ if ($idMax == '0') {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
}
@@ -495,9 +500,10 @@ SQL;
*
* @param integer $id_feed feed ID
* @param string $idMax fail safe article ID
+ * @param FreshRSS_BooleanSearch|null $filters
* @return integer|false affected rows
*/
- public function markReadFeed($id_feed, $idMax = '0', $filters = null, $state = 0, $is_read = true) {
+ public function markReadFeed(int $id_feed, string $idMax = '0', $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
if ($idMax == '0') {
$idMax = time() . '000000';
@@ -692,8 +698,11 @@ SQL;
return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL
}
- protected function sqlListEntriesWhere($alias = '', $filters = null, $state = FreshRSS_Entry::STATE_ALL,
- $order = 'DESC', $firstId = '', $date_min = 0) {
+ /**
+ * @param FreshRSS_BooleanSearch|null $filters
+ */
+ protected function sqlListEntriesWhere(string $alias = '', $filters = null, int $state = FreshRSS_Entry::STATE_ALL,
+ string $order = 'DESC', string $firstId = '', int $date_min = 0) {
$search = ' ';
$values = array();
if ($state & FreshRSS_Entry::STATE_NOT_READ) {
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index 72debd176..8b0f2d252 100644
--- a/app/Models/EntryDAOSQLite.php
+++ b/app/Models/EntryDAOSQLite.php
@@ -166,14 +166,15 @@ DROP TABLE IF EXISTS `tmp`;
* place. It will be reused also for the filtering making every thing
* separated.
*
- * @param integer $idMax fail safe article ID
+ * @param string $idMax fail safe article ID
* @param boolean $onlyFavorites
* @param integer $priorityMin
+ * @param FreshRSS_BooleanSearch|null $filters
* @return integer|false affected rows
*/
- public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filters = null, $state = 0, $is_read = true) {
+ public function markReadEntries(string $idMax = '0', bool $onlyFavorites = false, int $priorityMin = 0, $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
- if ($idMax == 0) {
+ if ($idMax == '0') {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
}
@@ -209,12 +210,13 @@ DROP TABLE IF EXISTS `tmp`;
* If $idMax equals 0, a deprecated debug message is logged
*
* @param integer $id category ID
- * @param integer $idMax fail safe article ID
+ * @param string $idMax fail safe article ID
+ * @param FreshRSS_BooleanSearch|null $filters
* @return integer|false affected rows
*/
- public function markReadCat($id, $idMax = 0, $filters = null, $state = 0, $is_read = true) {
+ public function markReadCat(int $id, string $idMax = '0', $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
- if ($idMax == 0) {
+ if ($idMax == '0') {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
}