diff options
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/EntryDAO.php | 11 | ||||
| -rw-r--r-- | app/Models/TagDAO.php | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index af859045d..68746c380 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -43,7 +43,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { protected static function sqlRegex(string $expression, string $regex, array &$values): string { // The implementation of this function is solely for MySQL and MariaDB static $databaseDAOMySQL = null; - if ($databaseDAOMySQL === null) { + if (!($databaseDAOMySQL instanceof FreshRSS_DatabaseDAO)) { $databaseDAOMySQL = new FreshRSS_DatabaseDAO(); } @@ -205,6 +205,8 @@ SQL; return true; } else { $info = $this->addEntryPrepared == false ? $this->pdo->errorInfo() : $this->addEntryPrepared->errorInfo(); + /** @var array{id:string,guid:string,title:string,author:string,content:string,link:string,date:int,lastSeen:int,hash:string, + * is_read:bool|int|null,is_favorite:bool|int|null,id_feed:int,tags:string,attributes?:null|string|array<string,mixed>} $valuesTmp */ /** @var array{0:string,1:int,2:string} $info */ if ($this->autoUpdateDb($info)) { $this->addEntryPrepared = null; @@ -315,6 +317,8 @@ SQL; return true; } else { $info = $this->updateEntryPrepared == false ? $this->pdo->errorInfo() : $this->updateEntryPrepared->errorInfo(); + /** @var array{id:string,guid:string,title:string,author:string,content:string,link:string,date:int,lastSeen:int,hash:string, + * is_read:bool|int|null,is_favorite:bool|int|null,id_feed:int,tags:string,attributes:array<string,mixed>} $valuesTmp */ /** @var array{0:string,1:int,2:string} $info */ if ($this->autoUpdateDb($info)) { return $this->updateEntry($valuesTmp); @@ -1461,7 +1465,9 @@ SQL; [$values, $sql] = $this->sqlListWhere($type, $id, $state, $filters, id_min: $id_min, id_max: $id_max, order: $order, continuation_id: $continuation_id, continuation_value: $continuation_value, limit: $limit, offset: $offset); $stm = $this->pdo->prepare($sql); - if ($stm !== false && $stm->execute($values) && ($res = $stm->fetchAll(PDO::FETCH_COLUMN, 0)) !== false) { + if ($stm !== false && $stm->execute($values)) { + /** @var list<int|numeric-string> $res */ + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); $res = array_map('strval', $res); /** @var list<numeric-string> $res */ return $res; @@ -1496,6 +1502,7 @@ SQL; if ($stm !== false && $stm->execute($values)) { $rows = $stm->fetchAll(PDO::FETCH_ASSOC); foreach ($rows as $row) { + /** @var array{guid:string,hex_hash:string} $row */ $result[$row['guid']] = $row['hex_hash']; } return $result; diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index 65e322d5a..a253f37c1 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -199,6 +199,7 @@ SQL; $stm = $this->pdo->query($sql); if ($stm !== false && ($res = $stm->fetchAll(PDO::FETCH_ASSOC)) !== false) { + /** @var list<array{id:int,name:string,unreads:int}> $res */ return self::daoToTags($res); } else { $info = $this->pdo->errorInfo(); @@ -236,6 +237,7 @@ SQL; $stm = $this->pdo->query($sql); if ($stm !== false) { $res = $stm->fetchAll(PDO::FETCH_ASSOC); + /** @var list<array{count:int|numeric-string}> $res */ return (int)$res[0]['count']; } $info = $this->pdo->errorInfo(); @@ -334,6 +336,7 @@ SQL; if ($stm !== false && $stm->execute($values) && ($lines = $stm->fetchAll(PDO::FETCH_ASSOC)) !== false) { $result = []; foreach ($lines as $line) { + /** @var array{id:int,name:string,checked:bool|int} $line */ $result[] = [ 'id' => (int)($line['id']), 'name' => $line['name'], |
