diff options
| author | 2023-10-30 20:47:27 +0100 | |
|---|---|---|
| committer | 2023-10-30 20:47:27 +0100 | |
| commit | 06d00995049db9c7b915f67cfd4a5708aace458f (patch) | |
| tree | 0176ca9761b34d72ffd597bd96da3c3ae4912d86 /app | |
| parent | 4a02352ccc1b313ce967415c6ac10a32aba1893a (diff) | |
Require PHP 7.4+ (#5720)
* Require PHP 7.4+
https://github.com/FreshRSS/FreshRSS/discussions/5474
* Update Docker oldest
Alpine 3.13 with PHP 7.4.26
* Add missing packets to Docker oldest
* Update to typed properties
https://php.net/migration74.new-features#migration74.new-features.core.typed-properties
* More types
Diffstat (limited to 'app')
26 files changed, 264 insertions, 476 deletions
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 95ac9ee39..820075f27 100644 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -7,9 +7,8 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController { /** * JavaScript request or not. - * @var bool */ - private $ajax = false; + private bool $ajax = false; /** * This action is called before every other action in that class. It is diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index dc11a2a46..8f611bc78 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -5,11 +5,9 @@ */ class FreshRSS_importExport_Controller extends FreshRSS_ActionController { - /** @var FreshRSS_EntryDAO */ - private $entryDAO; + private FreshRSS_EntryDAO $entryDAO; - /** @var FreshRSS_FeedDAO */ - private $feedDAO; + private FreshRSS_FeedDAO $feedDAO; /** * This action is called before every other action in that class. It is diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php index 4536e3f13..1a7c81841 100644 --- a/app/Controllers/tagController.php +++ b/app/Controllers/tagController.php @@ -7,9 +7,8 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController { /** * JavaScript request or not. - * @var bool|mixed */ - private $ajax = false; + private bool $ajax = false; /** * This action is called before every other action in that class. It is diff --git a/app/Exceptions/AlreadySubscribedException.php b/app/Exceptions/AlreadySubscribedException.php index c2b11d3a0..410784451 100644 --- a/app/Exceptions/AlreadySubscribedException.php +++ b/app/Exceptions/AlreadySubscribedException.php @@ -2,8 +2,7 @@ class FreshRSS_AlreadySubscribed_Exception extends Exception { - /** @var string */ - private $feedName = ''; + private string $feedName = ''; public function __construct(string $url, string $feedName) { parent::__construct('Already subscribed! ' . $url, 2135); diff --git a/app/Exceptions/FeedNotAddedException.php b/app/Exceptions/FeedNotAddedException.php index b10e93f05..4676c8eb3 100644 --- a/app/Exceptions/FeedNotAddedException.php +++ b/app/Exceptions/FeedNotAddedException.php @@ -2,8 +2,7 @@ class FreshRSS_FeedNotAdded_Exception extends Exception { - /** @var string */ - private $url = ''; + private string $url = ''; public function __construct(string $url) { parent::__construct('Feed not added! ' . $url, 2147); diff --git a/app/Exceptions/ZipException.php b/app/Exceptions/ZipException.php index ecf546533..d02cc1aea 100644 --- a/app/Exceptions/ZipException.php +++ b/app/Exceptions/ZipException.php @@ -2,8 +2,7 @@ class FreshRSS_Zip_Exception extends Exception { - /** @var int */ - private $zipErrorCode = 0; + private int $zipErrorCode = 0; public function __construct(int $zipErrorCode) { parent::__construct('ZIP error!', 2141); diff --git a/app/Models/Auth.php b/app/Models/Auth.php index f3c8b52f9..205b428a2 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -9,8 +9,7 @@ class FreshRSS_Auth { */ public const DEFAULT_COOKIE_DURATION = 7776000; - /** @var bool */ - private static $login_ok = false; + private static bool $login_ok = false; /** * This method initializes authentication system. diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php index 03fec4cb7..d8c47c878 100644 --- a/app/Models/BooleanSearch.php +++ b/app/Models/BooleanSearch.php @@ -5,16 +5,14 @@ */ class FreshRSS_BooleanSearch { - /** @var string */ - private $raw_input = ''; + private string $raw_input = ''; /** @var array<FreshRSS_BooleanSearch|FreshRSS_Search> */ - private $searches = []; + private array $searches = []; /** * @phpstan-var 'AND'|'OR'|'AND NOT' - * @var string */ - private $operator; + private string $operator; /** @param 'AND'|'OR'|'AND NOT' $operator */ public function __construct(string $input, int $level = 0, string $operator = 'AND') { diff --git a/app/Models/Category.php b/app/Models/Category.php index 1adf81f92..3bb64df8b 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -12,26 +12,19 @@ class FreshRSS_Category extends Minz_Model { */ public const KIND_DYNAMIC_OPML = 2; - /** @var int */ - private $id = 0; - /** @var int */ - private $kind = 0; - /** @var string */ - private $name; - /** @var int */ - private $nbFeeds = -1; - /** @var int */ - private $nbNotRead = -1; + private int $id = 0; + private int $kind = 0; + private string $name; + private int $nbFeeds = -1; + private int $nbNotRead = -1; /** @var array<FreshRSS_Feed>|null */ - private $feeds; + private ?array $feeds = null; /** @var bool|int */ private $hasFeedsWithError = false; /** @var array<string,mixed> */ - private $attributes = []; - /** @var int */ - private $lastUpdate = 0; - /** @var bool */ - private $error = false; + private array $attributes = []; + private int $lastUpdate = 0; + private bool $error = false; /** * @param array<FreshRSS_Feed>|null $feeds diff --git a/app/Models/Context.php b/app/Models/Context.php index 086d860dd..c1fa96ae7 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -6,50 +6,31 @@ */ final class FreshRSS_Context { - /** - * @var FreshRSS_UserConfiguration|null - */ - public static $user_conf; - - /** - * @var FreshRSS_SystemConfiguration|null - */ - public static $system_conf; + public static ?FreshRSS_UserConfiguration $user_conf = null; + public static ?FreshRSS_SystemConfiguration $system_conf = null; /** * @var array<int,FreshRSS_Category> */ - public static $categories = []; + public static array $categories = []; /** * @var array<int,FreshRSS_Tag> */ - public static $tags = []; - /** - * @var string - */ - public static $name = ''; - /** - * @var string - */ - public static $description = ''; - /** - * @var int - */ - public static $total_unread = 0; + public static array $tags = []; + public static string $name = ''; + public static string $description = ''; + public static int $total_unread = 0; /** @var array{'all':int,'read':int,'unread':int} */ - public static $total_starred = [ + public static array $total_starred = [ 'all' => 0, 'read' => 0, 'unread' => 0, ]; - /** - * @var int - */ - public static $get_unread = 0; + public static int $get_unread = 0; /** @var array{'all':bool,'starred':bool,'feed':int|false,'category':int|false,'tag':int|false,'tags':bool} */ - public static $current_get = [ + public static array $current_get = [ 'all' => false, 'starred' => false, 'feed' => false, @@ -58,45 +39,19 @@ final class FreshRSS_Context { 'tags' => false, ]; - /** - * @var string - */ - public static $next_get = 'a'; - /** - * @var int - */ - public static $state = 0; + public static string $next_get = 'a'; + public static int $state = 0; /** * @phpstan-var 'ASC'|'DESC' - * @var string - */ - public static $order = 'DESC'; - /** - * @var int - */ - public static $number = 0; - /** @var FreshRSS_BooleanSearch */ - public static $search; - /** - * @var string - */ - public static $first_id = ''; - /** - * @var string - */ - public static $next_id = ''; - /** - * @var string - */ - public static $id_max = ''; - /** - * @var int - */ - public static $sinceHours = 0; - /** - * @var bool */ - public static $isCli = false; + public static string $order = 'DESC'; + public static int $number = 0; + public static FreshRSS_BooleanSearch $search; + public static string $first_id = ''; + public static string $next_id = ''; + public static string $id_max = ''; + public static int $sinceHours = 0; + public static bool $isCli = false; /** * Initialize the context for the global system. diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 31aaf67a0..e3e61fb00 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -7,38 +7,26 @@ class FreshRSS_Entry extends Minz_Model { public const STATE_FAVORITE = 4; public const STATE_NOT_FAVORITE = 8; - /** @var string */ - private $id = '0'; - /** @var string */ - private $guid; - /** @var string */ - private $title; + private string $id = '0'; + private string $guid; + private string $title; /** @var array<string> */ - private $authors; - /** @var string */ - private $content; - /** @var string */ - private $link; - /** @var int */ - private $date; - /** @var int */ - private $lastSeen = 0; - /** @var string In microseconds */ - private $date_added = '0'; - /** @var string */ - private $hash = ''; - /** @var bool|null */ - private $is_read; - /** @var bool|null */ - private $is_favorite; - /** @var int */ - private $feedId; - /** @var FreshRSS_Feed|null */ - private $feed; + private array $authors; + private string $content; + private string $link; + private int $date; + private int $lastSeen = 0; + /** In microseconds */ + private string $date_added = '0'; + private string $hash = ''; + private ?bool $is_read; + private ?bool $is_favorite; + private int $feedId; + private ?FreshRSS_Feed $feed; /** @var array<string> */ - private $tags = []; + private array $tags = []; /** @var array<string,mixed> */ - private $attributes = []; + private array $attributes = []; /** * @param int|string $pubdate diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index f57fa17d7..b9f8d57cb 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -190,8 +190,7 @@ SQL; return $result; } - /** @var PDOStatement|null */ - private $updateEntryPrepared = null; + private ?PDOStatement $updateEntryPrepared = null; /** @param array{'id':string,'guid':string,'title':string,'author':string,'content':string,'link':string,'date':int,'lastSeen':int,'hash':string, * 'is_read':bool|int|null,'is_favorite':bool|int|null,'id_feed':int,'tags':string,'attributes':array<string,mixed>} $valuesTmp */ diff --git a/app/Models/Feed.php b/app/Models/Feed.php index e295804ae..64aebccfa 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -37,54 +37,32 @@ class FreshRSS_Feed extends Minz_Model { public const ARCHIVING_RETENTION_COUNT_LIMIT = 10000; public const ARCHIVING_RETENTION_PERIOD = 'P3M'; - /** @var int */ - private $id = 0; - /** @var string */ - private $url = ''; - /** @var int */ - private $kind = 0; - /** @var int */ - private $categoryId = 1; - /** @var FreshRSS_Category|null */ - private $category; - /** @var int */ - private $nbEntries = -1; - /** @var int */ - private $nbNotRead = -1; - /** @var int */ - private $nbPendingNotRead = 0; - /** @var string */ - private $name = ''; - /** @var string */ - private $website = ''; - /** @var string */ - private $description = ''; - /** @var int */ - private $lastUpdate = 0; - /** @var int */ - private $priority = self::PRIORITY_MAIN_STREAM; - /** @var string */ - private $pathEntries = ''; - /** @var string */ - private $httpAuth = ''; - /** @var bool */ - private $error = false; - /** @var int */ - private $ttl = self::TTL_DEFAULT; + private int $id = 0; + private string $url = ''; + private int $kind = 0; + private int $categoryId = 1; + private ?FreshRSS_Category $category; + private int $nbEntries = -1; + private int $nbNotRead = -1; + private int $nbPendingNotRead = 0; + private string $name = ''; + private string $website = ''; + private string $description = ''; + private int $lastUpdate = 0; + private int $priority = self::PRIORITY_MAIN_STREAM; + private string $pathEntries = ''; + private string $httpAuth = ''; + private bool $error = false; + private int $ttl = self::TTL_DEFAULT; /** @var array<string,mixed> */ - private $attributes = []; - /** @var bool */ - private $mute = false; - /** @var string */ - private $hash = ''; - /** @var string */ - private $lockPath = ''; - /** @var string */ - private $hubUrl = ''; - /** @var string */ - private $selfUrl = ''; + private array $attributes = []; + private bool $mute = false; + private string $hash = ''; + private string $lockPath = ''; + private string $hubUrl = ''; + private string $selfUrl = ''; /** @var array<FreshRSS_FilterAction> $filterActions */ - private $filterActions = null; + private array $filterActions = []; public function __construct(string $url, bool $validate = true) { if ($validate) { diff --git a/app/Models/FilterAction.php b/app/Models/FilterAction.php index e94456086..bd8b12a7a 100644 --- a/app/Models/FilterAction.php +++ b/app/Models/FilterAction.php @@ -2,10 +2,9 @@ class FreshRSS_FilterAction { - /** @var FreshRSS_BooleanSearch */ - private $booleanSearch = null; + private FreshRSS_BooleanSearch $booleanSearch; /** @var array<string>|null */ - private $actions = null; + private ?array $actions = null; /** @param array<string> $actions */ private function __construct(FreshRSS_BooleanSearch $booleanSearch, array $actions) { diff --git a/app/Models/Log.php b/app/Models/Log.php index 96714d1c7..c3f4bb244 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -3,12 +3,10 @@ declare(strict_types=1); class FreshRSS_Log extends Minz_Model { - /** @var string */ - private $date; - /** @var string */ - private $level; - /** @var string */ - private $information; + + private string $date; + private string $level; + private string $information; public function date(): string { return $this->date; diff --git a/app/Models/ReadingMode.php b/app/Models/ReadingMode.php index c0fa95b31..51ff26fd5 100644 --- a/app/Models/ReadingMode.php +++ b/app/Models/ReadingMode.php @@ -5,24 +5,12 @@ */ class FreshRSS_ReadingMode { - /** - * @var string - */ - protected $id; - /** - * @var string - */ - protected $name; - /** - * @var string - */ - protected $title; + protected string $id; + protected string $name; + protected string $title; /** @var array{'c':string,'a':string,'params':array<string,mixed>} */ - protected $urlParams; - /** - * @var bool - */ - protected $isActive = false; + protected array $urlParams; + protected bool $isActive = false; /** * ReadingMode constructor. diff --git a/app/Models/Search.php b/app/Models/Search.php index 404b8bfac..56f8d3834 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -12,64 +12,63 @@ class FreshRSS_Search { /** * This contains the user input string - * @var string */ - private $raw_input = ''; + private string $raw_input = ''; // The following properties are extracted from the raw input /** @var array<string>|null */ - private $entry_ids; + private ?array $entry_ids = null; /** @var array<int>|null */ - private $feed_ids; + private ?array $feed_ids = null; /** @var array<int>|'*'|null */ - private $label_ids; + private $label_ids = null; /** @var array<string>|null */ - private $label_names; + private ?array $label_names = null; /** @var array<string>|null */ - private $intitle; + private ?array $intitle = null; /** @var int|false|null */ - private $min_date; + private $min_date = null; /** @var int|false|null */ - private $max_date; + private $max_date = null; /** @var int|false|null */ - private $min_pubdate; + private $min_pubdate = null; /** @var int|false|null */ - private $max_pubdate; + private $max_pubdate = null; /** @var array<string>|null */ - private $inurl; + private ?array $inurl = null; /** @var array<string>|null */ - private $author; + private ?array $author = null; /** @var array<string>|null */ - private $tags; + private ?array $tags = null; /** @var array<string>|null */ - private $search; + private ?array $search = null; /** @var array<string>|null */ - private $not_entry_ids; + private ?array $not_entry_ids = null; /** @var array<int>|null */ - private $not_feed_ids; + private ?array $not_feed_ids = null; /** @var array<int>|'*'|null */ - private $not_label_ids; + private $not_label_ids = null; /** @var array<string>|null */ - private $not_label_names; + private ?array $not_label_names = null; /** @var array<string>|null */ - private $not_intitle; + private ?array $not_intitle = null; /** @var int|false|null */ - private $not_min_date; + private $not_min_date = null; /** @var int|false|null */ - private $not_max_date; + private $not_max_date = null; /** @var int|false|null */ - private $not_min_pubdate; + private $not_min_pubdate = null; /** @var int|false|null */ - private $not_max_pubdate; + private $not_max_pubdate = null; /** @var array<string>|null */ - private $not_inurl; + private ?array $not_inurl = null; /** @var array<string>|null */ - private $not_author; + private ?array $not_author = null; /** @var array<string>|null */ - private $not_tags; + private ?array $not_tags = null; /** @var array<string>|null */ - private $not_search; + private ?array $not_search = null; public function __construct(string $input) { $input = self::cleanSearch($input); diff --git a/app/Models/Share.php b/app/Models/Share.php index ae2c4a6b8..b0665a07c 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -8,7 +8,7 @@ class FreshRSS_Share { * The list of available sharing options. * @var array<string,FreshRSS_Share> */ - private static $list_sharing = []; + private static array $list_sharing = []; /** * Register a new sharing option. @@ -71,45 +71,31 @@ class FreshRSS_Share { } - /** @var string */ - private $type; - /** @var string */ - private $name; - /** @var string */ - private $url_transform; + private string $type; + private string $name; + private string $url_transform; /** @var array<callable>|array<string,array<callable>> */ - private $transforms; + private array $transforms; /** * @phpstan-var 'simple'|'advanced' - * @var string */ - private $form_type; - /** @var string */ - private $help_url; - /** @var string|null */ - private $custom_name = null; - /** @var string|null */ - private $base_url = null; - /** @var string|null */ - private $id = null; - /** @var string|null */ - private $title = null; - /** @var string|null */ - private $link = null; - /** @var bool */ - private $isDeprecated; + private string $form_type; + private string $help_url; + private ?string $custom_name = null; + private ?string $base_url = null; + private ?string $id = null; + private ?string $title = null; + private ?string $link = null; + private bool $isDeprecated; /** * @phpstan-var 'GET'|'POST' - * @var string */ - private $method; - /** @var string|null */ - private $field; + private string $method; + private ?string $field; /** * @phpstan-var 'button'|null - * @var string */ - private $HTMLtag; + private ?string $HTMLtag; /** * Create a FreshRSS_Share object. diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 4ab28a286..920422ac8 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -1,26 +1,15 @@ <?php class FreshRSS_Tag extends Minz_Model { - /** - * @var int - */ - private $id = 0; - /** - * @var string - */ - private $name; + + private int $id = 0; + private string $name; /** * @var array<string,mixed> */ - private $attributes = []; - /** - * @var int - */ - private $nbEntries = -1; - /** - * @var int - */ - private $nbUnread = -1; + private array $attributes = []; + private int $nbEntries = -1; + private int $nbUnread = -1; public function __construct(string $name = '') { $this->_name($name); diff --git a/app/Models/Themes.php b/app/Models/Themes.php index 24539855b..ab99ea63c 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -1,12 +1,10 @@ <?php class FreshRSS_Themes extends Minz_Model { - /** @var string */ - private static $themesUrl = '/themes/'; - /** @var string */ - private static $defaultIconsUrl = '/themes/icons/'; - /** @var string */ - public static $defaultTheme = 'Origine'; + + private static string $themesUrl = '/themes/'; + private static string $defaultIconsUrl = '/themes/icons/'; + public static string $defaultTheme = 'Origine'; /** @return array<string> */ public static function getList(): array { @@ -51,10 +49,9 @@ class FreshRSS_Themes extends Minz_Model { return false; } - /** @var string */ - private static $themeIconsUrl; + private static string $themeIconsUrl; /** @var array<string,int> */ - private static $themeIcons; + private static array $themeIcons; /** * @return false|array{'id':string,'name':string,'author':string,'description':string,'version':float|string,'files':array<string>,'theme-color'?:string|array{'dark'?:string,'light'?:string,'default'?:string}} diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 2f7968315..3454ede31 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -8,30 +8,18 @@ */ class FreshRSS_UserQuery { - /** @var bool */ - private $deprecated = false; - /** @var string */ - private $get = ''; - /** @var string */ - private $get_name = ''; - /** @var string */ - private $get_type = ''; - /** @var string */ - private $name = ''; - /** @var string */ - private $order = ''; - /** @var FreshRSS_BooleanSearch */ - private $search; - /** @var int */ - private $state = 0; - /** @var string */ - private $url = ''; - /** @var FreshRSS_FeedDAO|null */ - private $feed_dao; - /** @var FreshRSS_CategoryDAO|null */ - private $category_dao; - /** @var FreshRSS_TagDAO|null */ - private $tag_dao; + private bool $deprecated = false; + private string $get = ''; + private string $get_name = ''; + private string $get_type = ''; + private string $name = ''; + private string $order = ''; + private FreshRSS_BooleanSearch $search; + private int $state = 0; + private string $url = ''; + private ?FreshRSS_FeedDAO $feed_dao; + private ?FreshRSS_CategoryDAO $category_dao; + private ?FreshRSS_TagDAO $tag_dao; /** * @param array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string} $query diff --git a/app/Models/View.php b/app/Models/View.php index f1bc55707..b8d776fbc 100644 --- a/app/Models/View.php +++ b/app/Models/View.php @@ -10,166 +10,121 @@ class FreshRSS_View extends Minz_View { /** @var callable */ public $callbackBeforePagination; /** @var array<FreshRSS_Category> */ - public $categories; - /** @var FreshRSS_Category|null */ - public $category; - /** @var string */ - public $current_user; + public array $categories; + public ?FreshRSS_Category $category; + public string $current_user; /** @var iterable<FreshRSS_Entry> */ public $entries; - /** @var FreshRSS_Entry */ - public $entry; - /** @var FreshRSS_Feed|null */ - public $feed; + public FreshRSS_Entry $entry; + public ?FreshRSS_Feed $feed; /** @var array<FreshRSS_Feed> */ - public $feeds; - /** @var int */ - public $nbUnreadTags; + public array $feeds; + public int $nbUnreadTags; /** @var array<FreshRSS_Tag> */ - public $tags; + public array $tags; /** @var array<int,array{'id':int,'name':string,'id_entry':string,'checked':bool}> */ - public $tagsForEntry; + public array $tagsForEntry; /** @var array<string,array<string>> */ - public $tagsForEntries; + public array $tagsForEntries; /** @var array<string,string> */ - public $notification; - /** @var bool */ - public $excludeMutedFeeds; + public array $notification; + public bool $excludeMutedFeeds; // Substriptions - /** @var FreshRSS_Category|null */ - public $default_category; - /** @var bool */ - public $displaySlider; - /** @var bool */ - public $load_ok; - /** @var bool */ - public $onlyFeedsWithError; - /** @var bool */ - public $signalError; + public ?FreshRSS_Category $default_category; + public bool $displaySlider = false; + public bool $load_ok; + public bool $onlyFeedsWithError; + public bool $signalError; // Manage users /** @var array{'feed_count':int,'article_count':int,'database_size':int,'language':string,'mail_login':string,'enabled':bool,'is_admin':bool,'last_user_activity':string,'is_default':bool} */ - public $details; - /** @var bool */ - public $disable_aside; - /** @var bool */ - public $show_email_field; - /** @var string */ - public $username; + public array $details; + public bool $disable_aside; + public bool $show_email_field; + public string $username; /** @var array<array{'language':string,'enabled':bool,'is_admin':bool,'enabled':bool,'article_count':int,'database_size':int,'last_user_activity':string,'mail_login':string,'feed_count':int,'is_default':bool}> */ - public $users; + public array $users; // Updates - /** @var string */ - public $last_update_time; + public string $last_update_time; /** @var array<string,bool> */ - public $status_files; + public array $status_files; /** @var array<string,bool> */ - public $status_php; - /** @var bool */ - public $update_to_apply; + public array $status_php; + public bool $update_to_apply; /** @var array<string,bool> */ - public $status_database; - /** @var bool */ - public $is_release_channel_stable; + public array $status_database; + public bool $is_release_channel_stable; // Archiving - /** @var int */ - public $nb_total; - /** @var int */ - public $size_total; - /** @var int */ - public $size_user; + public int $nb_total; + public int $size_total; + public int $size_user; // Display /** @var array<string,array{'id':string,'name':string,'author':string,'description':string,'version':float|string,'files':array<string>,'theme-color'?:string|array{'dark'?:string,'light'?:string,'default'?:string}}> */ - public $themes; + public array $themes; // Shortcuts /** @var array<int, string> */ - public $list_keys; + public array $list_keys; // User queries /** @var array<int,FreshRSS_UserQuery> */ - public $queries; + public array $queries; /** @var FreshRSS_UserQuery|null */ - public $query; + public ?FreshRSS_UserQuery $query = null; // Export / Import - /** @var string */ - public $content; + public string $content; /** @var array<string,array<string>> */ - public $entryIdsTagNames; - /** @var string */ - public $list_title; - /** @var int */ - public $queryId; - /** @var string */ - public $type; + public array $entryIdsTagNames; + public string $list_title; + public int $queryId; + public string $type; // Form login - /** @var int */ - public $cookie_days; + public int $cookie_days; // Registration - /** @var bool */ - public $can_register; - /** @var string */ - public $preferred_language; - /** @var bool */ - public $show_tos_checkbox; - /** @var string */ - public $terms_of_service; - /** @var string */ - public $site_title; - /** @var string */ - public $validation_url; + public bool $can_register; + public string $preferred_language; + public bool $show_tos_checkbox; + public string $terms_of_service; + public string $site_title; + public string $validation_url; // Logs - /** @var int */ - public $currentPage; - /** @var Minz_Paginator */ - public $logsPaginator; - /** @var int */ - public $nbPage; + public int $currentPage; + public Minz_Paginator $logsPaginator; + public int $nbPage; // RSS view - /** @var string */ - public $rss_title = ''; - /** @var string */ - public $rss_url = ''; - /** @var string */ - public $rss_base = ''; - /** @var bool */ - public $internal_rendering = false; + public string $rss_title = ''; + public string $rss_url = ''; + public string $rss_base = ''; + public bool $internal_rendering = false; // Content preview - /** @var string */ - public $fatalError; - /** @var string */ - public $htmlContent; - /** @var bool */ - public $selectorSuccess; + public string $fatalError; + public string $htmlContent; + public bool $selectorSuccess; // Extensions /** @var array<string,array{'name':string,'author':string,'description':string,'version':string,'entrypoint':string,'type':'system'|'user','url':string,'method':string,'directory':string}> */ - public $available_extensions; - /** @var ?Minz_Extension */ - public $ext_details; + public array $available_extensions; + public ?Minz_Extension $ext_details; /** @var array{'system':array<Minz_Extension>,'user':array<Minz_Extension>} */ - public $extension_list; - /** @var ?Minz_Extension */ - public $extension; + public array $extension_list; + public ?Minz_Extension $extension; /** @var array<string,string> */ - public $extensions_installed; + public array $extensions_installed; // Errors - /** @var string */ - public $code; - /** @var string */ - public $errorMessage; + public string $code; + public string $errorMessage; /** @var array<string,string> */ - public $message; + public array $message; } diff --git a/app/Models/ViewJavascript.php b/app/Models/ViewJavascript.php index 62d0339eb..157ebe4ae 100644 --- a/app/Models/ViewJavascript.php +++ b/app/Models/ViewJavascript.php @@ -5,14 +5,12 @@ declare(strict_types=1); final class FreshRSS_ViewJavascript extends FreshRSS_View { /** @var array<FreshRSS_Category> */ - public $categories; + public array $categories; /** @var array<FreshRSS_Feed> */ - public $feeds; + public array $feeds; /** @var array<FreshRSS_Tag> */ - public $tags; + public array $tags; - /** @var string */ - public $nonce; - /** @var string */ - public $salt1; + public string $nonce; + public string $salt1; } diff --git a/app/Models/ViewStats.php b/app/Models/ViewStats.php index 9025a86db..f07c19c91 100644 --- a/app/Models/ViewStats.php +++ b/app/Models/ViewStats.php @@ -4,54 +4,47 @@ declare(strict_types=1); final class FreshRSS_ViewStats extends FreshRSS_View { - /** @var FreshRSS_Category|null */ - public $default_category; + public ?FreshRSS_Category $default_category; /** @var array<FreshRSS_Category> */ - public $categories; - /** @var FreshRSS_Feed|null */ - public $feed; + public array $categories; + public ?FreshRSS_Feed $feed; /** @var array<FreshRSS_Feed> */ - public $feeds; - /** @var bool */ - public $displaySlider; + public array $feeds; + public bool $displaySlider = false; - /** @var float */ - public $average; - /** @var float */ - public $averageDayOfWeek; - /** @var float */ - public $averageHour; - /** @var float */ - public $averageMonth; + public float $average; + public float $averageDayOfWeek; + public float $averageHour; + public float $averageMonth; /** @var array<string> */ - public $days; + public array $days; /** @var array<string,array<int,int|string>> */ - public $entryByCategory; + public array $entryByCategory; /** @var array<int,int> */ - public $entryCount; + public array $entryCount; /** @var array<string,array<int,int|string>> */ - public $feedByCategory; + public array $feedByCategory; /** @var array<int, string> */ - public $hours24Labels; + public array $hours24Labels; /** @var array<string,array<int,array<string,int|string>>> */ - public $idleFeeds; + public array $idleFeeds; /** @var array<int,string> */ - public $last30DaysLabel; + public array $last30DaysLabel; /** @var array<int,string> */ - public $last30DaysLabels; + public array $last30DaysLabels; /** @var array<string,string> */ - public $months; + public array $months; /** @var array{'total':int,'count_unreads':int,'count_reads':int,'count_favorites':int}|false */ public $repartition; /** @var array{'main_stream':array{'total':int,'count_unreads':int,'count_reads':int,'count_favorites':int}|false,'all_feeds':array{'total':int,'count_unreads':int,'count_reads':int,'count_favorites':int}|false} */ - public $repartitions; + public array $repartitions; /** @var array<int,int> */ - public $repartitionDayOfWeek; + public array $repartitionDayOfWeek; /** @var array<string,int>|array<int,int> */ - public $repartitionHour; + public array $repartitionHour; /** @var array<int,int> */ - public $repartitionMonth; + public array $repartitionMonth; /** @var array<array{'id':int,'name':string,'category':string,'count':int}> */ - public $topFeed; + public array $topFeed; } diff --git a/app/Services/ExportService.php b/app/Services/ExportService.php index d3a3373a5..80531f3fc 100644 --- a/app/Services/ExportService.php +++ b/app/Services/ExportService.php @@ -4,20 +4,16 @@ * Provide useful methods to generate files to export. */ class FreshRSS_Export_Service { - /** @var string */ - private $username; - /** @var FreshRSS_CategoryDAO */ - private $category_dao; + private string $username; - /** @var FreshRSS_FeedDAO */ - private $feed_dao; + private FreshRSS_CategoryDAO $category_dao; - /** @var FreshRSS_EntryDAO */ - private $entry_dao; + private FreshRSS_FeedDAO $feed_dao; - /** @var FreshRSS_TagDAO */ - private $tag_dao; + private FreshRSS_EntryDAO $entry_dao; + + private FreshRSS_TagDAO $tag_dao; public const FRSS_NAMESPACE = 'https://freshrss.org/opml'; public const TYPE_HTML_XPATH = 'HTML+XPath'; diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index b70627295..9b013fea4 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -4,14 +4,13 @@ * Provide methods to import files. */ class FreshRSS_Import_Service { - /** @var FreshRSS_CategoryDAO */ - private $catDAO; - /** @var FreshRSS_FeedDAO */ - private $feedDAO; + private FreshRSS_CategoryDAO $catDAO; - /** @var bool true if success, false otherwise */ - private $lastStatus; + private FreshRSS_FeedDAO $feedDAO; + + /** true if success, false otherwise */ + private bool $lastStatus; /** * Initialize the service for the given user. |
