From 350edf398c55b472e19a3017de9b4d2d3420b9e4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 10 Apr 2024 15:33:43 +0200 Subject: 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 --- app/Models/EntryDAOSQLite.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/Models/EntryDAOSQLite.php') diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index 1a87d03be..91894b8ac 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -3,27 +3,33 @@ declare(strict_types=1); class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { + #[\Override] public static function isCompressed(): bool { return false; } + #[\Override] public static function hasNativeHex(): bool { return false; } + #[\Override] protected static function sqlConcat(string $s1, string $s2): string { return $s1 . '||' . $s2; } + #[\Override] public static function sqlHexDecode(string $x): string { return $x; } + #[\Override] public static function sqlIgnoreConflict(string $sql): string { return str_replace('INSERT INTO ', 'INSERT OR IGNORE INTO ', $sql); } /** @param array $errorInfo */ + #[\Override] protected function autoUpdateDb(array $errorInfo): bool { if ($tableInfo = $this->pdo->query("PRAGMA table_info('entry')")) { $columns = $tableInfo->fetchAll(PDO::FETCH_COLUMN, 1) ?: []; @@ -36,6 +42,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { return false; } + #[\Override] public function commitNewEntries(): bool { $sql = <<<'SQL' DROP TABLE IF EXISTS `tmp`; @@ -74,6 +81,7 @@ SQL; * @param bool $is_read * @return int|false affected rows */ + #[\Override] public function markRead($ids, bool $is_read = true) { FreshRSS_UserDAO::touch(); if (is_array($ids)) { //Many IDs at once (used by API) @@ -119,6 +127,7 @@ SQL; * @param string $idMax max article ID * @return int|false affected rows */ + #[\Override] 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) { -- cgit v1.2.3