aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-12-17 10:11:18 +0100
committerGravatar GitHub <noreply@github.com> 2025-12-17 10:11:18 +0100
commit00cd5df294c875ea1e00ab2f645a338a6bd92c8e (patch)
treee1dc56d3d01bffea632d1d4c08a1153d7ea7a7c5 /app
parent4bd503591469f47e710f1afbf0b5883f7770065d (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')
-rw-r--r--app/Controllers/indexController.php6
-rw-r--r--app/Models/Context.php9
-rw-r--r--app/Models/Entry.php6
-rw-r--r--app/Models/Feed.php2
-rw-r--r--app/Models/SimplePieCustom.php4
5 files changed, 18 insertions, 9 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 7def8e781..732e4248a 100644
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -227,8 +227,8 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
/**
* This action displays the RSS feed of FreshRSS.
- * @deprecated See user query RSS sharing instead
*/
+ #[Deprecated('See user query RSS sharing instead')]
public function rssAction(): void {
$allow_anonymous = FreshRSS_Context::systemConf()->allow_anonymous;
@@ -262,9 +262,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
header('Content-Type: application/rss+xml; charset=utf-8');
}
- /**
- * @deprecated See user query OPML sharing instead
- */
+ #[Deprecated('See user query OPML sharing instead')]
public function opmlAction(): void {
$allow_anonymous = FreshRSS_Context::systemConf()->allow_anonymous;
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);