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/EntryDAOPGSQL.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/Models/EntryDAOPGSQL.php') diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php index 39e86384d..8adeffe9e 100644 --- a/app/Models/EntryDAOPGSQL.php +++ b/app/Models/EntryDAOPGSQL.php @@ -3,23 +3,28 @@ declare(strict_types=1); class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite { + #[\Override] public static function hasNativeHex(): bool { return true; } + #[\Override] public static function sqlHexDecode(string $x): string { return 'decode(' . $x . ", 'hex')"; } + #[\Override] public static function sqlHexEncode(string $x): string { return 'encode(' . $x . ", 'hex')"; } + #[\Override] public static function sqlIgnoreConflict(string $sql): string { return rtrim($sql, ' ;') . ' ON CONFLICT DO NOTHING'; } /** @param array $errorInfo */ + #[\Override] protected function autoUpdateDb(array $errorInfo): bool { if (isset($errorInfo[0])) { if ($errorInfo[0] === FreshRSS_DatabaseDAO::ER_BAD_FIELD_ERROR || $errorInfo[0] === FreshRSS_DatabaseDAOPGSQL::UNDEFINED_COLUMN) { @@ -34,6 +39,7 @@ class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite { return false; } + #[\Override] public function commitNewEntries(): bool { //TODO: Update to PostgreSQL 9.5+ syntax with ON CONFLICT DO NOTHING $sql = 'DO $$ -- cgit v1.2.3