aboutsummaryrefslogtreecommitdiff
path: root/app/Models/DatabaseDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-04-10 15:33:43 +0200
committerGravatar GitHub <noreply@github.com> 2024-04-10 15:33:43 +0200
commit350edf398c55b472e19a3017de9b4d2d3420b9e4 (patch)
tree00672f4cba0830e4b39f778e3a36de6b961fc5bb /app/Models/DatabaseDAOSQLite.php
parent8280e3d88edb93211fcf2aec15a7b4c1ae4d3813 (diff)
PHP 8.3 #[\Override] (#6273)
* PHP 8.3 #[\Override] https://php.watch/versions/8.3/override-attr With PHPStan `checkMissingOverrideMethodAttribute` https://phpstan.org/config-reference#checkmissingoverridemethodattribute And modified the call to phpstan-next on the model of https://github.com/FreshRSS/Extensions/pull/228 (more robust than the find method, which gave some strange errors) * Update extension example accordingly
Diffstat (limited to 'app/Models/DatabaseDAOSQLite.php')
-rw-r--r--app/Models/DatabaseDAOSQLite.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php
index e72cc74e8..0ac6ee8f5 100644
--- a/app/Models/DatabaseDAOSQLite.php
+++ b/app/Models/DatabaseDAOSQLite.php
@@ -6,6 +6,7 @@ declare(strict_types=1);
*/
class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
+ #[\Override]
public function tablesAreCorrect(): bool {
$sql = 'SELECT name FROM sqlite_master WHERE type="table"';
$stm = $this->pdo->query($sql);
@@ -30,18 +31,21 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
}
/** @return array<array<string,string|int|bool|null>> */
+ #[\Override]
public function getSchema(string $table): array {
$sql = 'PRAGMA table_info(' . $table . ')';
$stm = $this->pdo->query($sql);
return $stm ? $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC) ?: []) : [];
}
+ #[\Override]
public function entryIsCorrect(): bool {
return $this->checkTable('entry', [
'id', 'guid', 'title', 'author', 'content', 'link', 'date', 'lastSeen', 'hash', 'is_read', 'is_favorite', 'id_feed', 'tags',
]);
}
+ #[\Override]
public function entrytmpIsCorrect(): bool {
return $this->checkTable('entrytmp', [
'id', 'guid', 'title', 'author', 'content', 'link', 'date', 'lastSeen', 'hash', 'is_read', 'is_favorite', 'id_feed', 'tags'
@@ -52,6 +56,7 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
* @param array<string,string|int|bool|null> $dao
* @return array{'name':string,'type':string,'notnull':bool,'default':mixed}
*/
+ #[\Override]
public function daoToSchema(array $dao): array {
return [
'name' => (string)$dao['name'],
@@ -61,6 +66,7 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
];
}
+ #[\Override]
public function size(bool $all = false): int {
$sum = 0;
if ($all) {
@@ -73,6 +79,7 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
return $sum;
}
+ #[\Override]
public function optimize(): bool {
$ok = $this->pdo->exec('VACUUM') !== false;
if (!$ok) {