aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-03-22 09:57:31 +0100
committerGravatar GitHub <noreply@github.com> 2023-03-22 09:57:31 +0100
commite750448f5b32982170f81ca045f9f7e8dc8eed6f (patch)
tree4053a9bfdcc5764cdc8ed93e9be73f54da7bd9d4 /app/Models/EntryDAOSQLite.php
parent1a0616562db5c096dc7ca187f0210b3d57bffebf (diff)
Consistent entry ID type (32-bit compatibility) (#5213)
* Remove FreshRSS_Searchable for better types The interface was not used, and it was preventing more precise types for the different `searchById()` methods, as they each have different input and output types. * Consistent entry ID Entry IDs (which are 64-bit integers) must be processed as string to be compatible with 32-bit platforms * Fix type * A few more related types * PHPStan level 6 * Some more casts needed * String cast for htmlspecialchars
Diffstat (limited to 'app/Models/EntryDAOSQLite.php')
-rw-r--r--app/Models/EntryDAOSQLite.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index 35f3ef676..e509097f2 100644
--- a/app/Models/EntryDAOSQLite.php
+++ b/app/Models/EntryDAOSQLite.php
@@ -10,7 +10,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
return false;
}
- protected static function sqlConcat($s1, $s2) {
+ protected static function sqlConcat(string $s1, string $s2): string {
return $s1 . '||' . $s2;
}
@@ -22,7 +22,8 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
return str_replace('INSERT INTO ', 'INSERT OR IGNORE INTO ', $sql);
}
- protected function autoUpdateDb(array $errorInfo) {
+ /** @param array<string> $errorInfo */
+ protected function autoUpdateDb(array $errorInfo): bool {
if ($tableInfo = $this->pdo->query("PRAGMA table_info('entry')")) {
$columns = $tableInfo->fetchAll(PDO::FETCH_COLUMN, 1);
foreach (['attributes'] as $column) {
@@ -47,7 +48,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
return false;
}
- public function commitNewEntries() {
+ public function commitNewEntries(): bool {
$sql = '
DROP TABLE IF EXISTS `tmp`;
CREATE TEMP TABLE `tmp` AS
@@ -115,7 +116,7 @@ DROP TABLE IF EXISTS `tmp`;
* @todo remove code duplication. It seems the code is basically the
* same if it is an array or not.
*
- * @param integer|array $ids
+ * @param string|array<string> $ids
* @param boolean $is_read
* @return integer|false affected rows
*/
@@ -177,10 +178,10 @@ DROP TABLE IF EXISTS `tmp`;
* @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(string $idMax = '0', bool $onlyFavorites = false, int $priorityMin = 0, $filters = null, int $state = 0, bool $is_read = true) {
+ public function markReadEntries(string $idMax = '0', bool $onlyFavorites = false, int $priorityMin = 0,
+ ?FreshRSS_BooleanSearch $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
if ($idMax == '0') {
$idMax = time() . '000000';
@@ -219,10 +220,9 @@ DROP TABLE IF EXISTS `tmp`;
*
* @param integer $id category ID
* @param string $idMax fail safe article ID
- * @param FreshRSS_BooleanSearch|null $filters
* @return integer|false affected rows
*/
- public function markReadCat(int $id, string $idMax = '0', $filters = null, int $state = 0, bool $is_read = true) {
+ public function markReadCat(int $id, string $idMax = '0', ?FreshRSS_BooleanSearch $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
if ($idMax == '0') {
$idMax = time() . '000000';
@@ -256,7 +256,7 @@ DROP TABLE IF EXISTS `tmp`;
* @param string $idMax max article ID
* @return integer|false affected rows
*/
- public function markReadTag($id = 0, string $idMax = '0', $filters = null, int $state = 0, bool $is_read = true) {
+ public function markReadTag($id = 0, string $idMax = '0', ?FreshRSS_BooleanSearch $filters = null, int $state = 0, bool $is_read = true) {
FreshRSS_UserDAO::touch();
if ($idMax == 0) {
$idMax = time() . '000000';