Update dev dependencies (#4993)

Related to https://github.com/FreshRSS/FreshRSS/pull/4991
Required a few changes in code to pass the tests
This commit is contained in:
Alexandre Alapetite
2023-01-09 12:59:30 +01:00
committed by GitHub
parent 3fb8ab8eb5
commit 1d9d4e3e3c
17 changed files with 955 additions and 752 deletions

View File

@@ -18,16 +18,17 @@ class FreshRSS_UserQuery {
private $search;
private $state;
private $url;
/** @var FreshRSS_FeedDAO */
private $feed_dao;
/** @var FreshRSS_CategoryDAO */
private $category_dao;
/** @var FreshRSS_TagDAO */
private $tag_dao;
/**
* @param array<string,string> $query
* @param FreshRSS_Searchable $feed_dao
* @param FreshRSS_Searchable $category_dao
*/
public function __construct($query, FreshRSS_Searchable $feed_dao = null, FreshRSS_Searchable $category_dao = null, FreshRSS_Searchable $tag_dao = null) {
public function __construct($query, FreshRSS_FeedDAO $feed_dao = null, FreshRSS_CategoryDAO $category_dao = null, FreshRSS_TagDAO $tag_dao = null) {
$this->category_dao = $category_dao;
$this->feed_dao = $feed_dao;
$this->tag_dao = $tag_dao;
@@ -83,21 +84,22 @@ class FreshRSS_UserQuery {
private function parseGet($get) {
$this->get = $get;
if (preg_match('/(?P<type>[acfst])(_(?P<id>\d+))?/', $get, $matches)) {
$id = intval($matches['id'] ?? '0');
switch ($matches['type']) {
case 'a':
$this->parseAll();
break;
case 'c':
$this->parseCategory($matches['id']);
$this->parseCategory($id);
break;
case 'f':
$this->parseFeed($matches['id']);
$this->parseFeed($id);
break;
case 's':
$this->parseFavorite();
break;
case 't':
$this->parseTag($matches['id']);
$this->parseTag($id);
break;
}
}
@@ -114,11 +116,10 @@ class FreshRSS_UserQuery {
/**
* Parse the query string when it is a "category" query
*
* @param integer $id
* @throws FreshRSS_DAO_Exception
*/
private function parseCategory($id) {
if (is_null($this->category_dao)) {
private function parseCategory(int $id) {
if ($this->category_dao === null) {
throw new FreshRSS_DAO_Exception('Category DAO is not loaded in UserQuery');
}
$category = $this->category_dao->searchById($id);
@@ -133,11 +134,10 @@ class FreshRSS_UserQuery {
/**
* Parse the query string when it is a "feed" query
*
* @param integer $id
* @throws FreshRSS_DAO_Exception
*/
private function parseFeed($id) {
if (is_null($this->feed_dao)) {
private function parseFeed(int $id) {
if ($this->feed_dao === null) {
throw new FreshRSS_DAO_Exception('Feed DAO is not loaded in UserQuery');
}
$feed = $this->feed_dao->searchById($id);
@@ -152,10 +152,9 @@ class FreshRSS_UserQuery {
/**
* Parse the query string when it is a "tag" query
*
* @param integer $id
* @throws FreshRSS_DAO_Exception
*/
private function parseTag($id) {
private function parseTag(int $id) {
if ($this->tag_dao == null) {
throw new FreshRSS_DAO_Exception('Tag DAO is not loaded in UserQuery');
}