diff options
| author | 2025-12-17 10:11:18 +0100 | |
|---|---|---|
| committer | 2025-12-17 10:11:18 +0100 | |
| commit | 00cd5df294c875ea1e00ab2f645a338a6bd92c8e (patch) | |
| tree | e1dc56d3d01bffea632d1d4c08a1153d7ea7a7c5 /app/Models | |
| parent | 4bd503591469f47e710f1afbf0b5883f7770065d (diff) | |
Use native PHP #[Deprecated] (#8325)
https://php.watch/versions/8.4/Deprecated
And enfore it with PHPUnit + PHPStan.
Especially useful for extensions.
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Context.php | 9 | ||||
| -rw-r--r-- | app/Models/Entry.php | 6 | ||||
| -rw-r--r-- | app/Models/Feed.php | 2 | ||||
| -rw-r--r-- | app/Models/SimplePieCustom.php | 4 |
4 files changed, 16 insertions, 5 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php index cc1b77026..a8feb7dbd 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -57,11 +57,13 @@ final class FreshRSS_Context { /** * @access private * @deprecated Will be made `private`; use `FreshRSS_Context::systemConf()` instead. + * @internal */ public static ?FreshRSS_SystemConfiguration $system_conf = null; /** * @access private * @deprecated Will be made `private`; use `FreshRSS_Context::userConf()` instead. + * @internal */ public static ?FreshRSS_UserConfiguration $user_conf = null; @@ -186,6 +188,13 @@ final class FreshRSS_Context { FreshRSS_Context::$user_conf = null; } + /** + * @internal + */ + public static function setUserConf(?FreshRSS_UserConfiguration $user_conf): void { + FreshRSS_Context::$user_conf = $user_conf; + } + /** @return array<int,FreshRSS_Category> where the key is the category ID */ public static function categories(): array { if (empty(self::$categories)) { diff --git a/app/Models/Entry.php b/app/Models/Entry.php index fa12ceb66..9d9f880fd 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -160,7 +160,8 @@ class FreshRSS_Entry extends Minz_Model { } return $title; } - /** @deprecated */ + + #[Deprecated('Use authors() instead')] public function author(): string { return $this->authors(true); } @@ -540,7 +541,8 @@ HTML; $this->hash = ''; $this->title = trim($value); } - /** @deprecated */ + + #[Deprecated('Use _authors() instead')] public function _author(string $value): void { $this->_authors($value); } diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 5cf82b718..19ff4fa81 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -40,7 +40,7 @@ class FreshRSS_Feed extends Minz_Model { public const PRIORITY_CATEGORY = 0; public const PRIORITY_FEED = -5; public const PRIORITY_HIDDEN = -10; - /** @deprecated use PRIORITY_HIDDEN instead */ + #[Deprecated('Use PRIORITY_HIDDEN instead')] public const PRIORITY_ARCHIVED = -10; public const TTL_DEFAULT = 0; diff --git a/app/Models/SimplePieCustom.php b/app/Models/SimplePieCustom.php index c3593e4a2..44e5b030e 100644 --- a/app/Models/SimplePieCustom.php +++ b/app/Models/SimplePieCustom.php @@ -13,8 +13,8 @@ final class FreshRSS_SimplePieCustom extends \SimplePie\SimplePie $limits = FreshRSS_Context::systemConf()->limits; $this->get_registry()->register(\SimplePie\File::class, FreshRSS_SimplePieFetch::class); $this->set_useragent(FRESHRSS_USERAGENT); - $this->set_cache_name_function('sha1'); - $this->set_cache_location(CACHE_PATH); + $this->set_cache_name_function('sha1'); // @phpstan-ignore method.deprecated + $this->set_cache_location(CACHE_PATH); // @phpstan-ignore method.deprecated $this->set_cache_duration($limits['cache_duration'], $limits['cache_duration_min'], $limits['cache_duration_max']); $this->enable_order_by_date(false); |
