A free, self-hostable news aggregator…
Pass phpstan-strict-rules 2.0.4 (#7488)
Alexandre Alapetite78dfb4406092
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.phpindex ee0d02d6c..7dfb32076 100644--- a/app/Models/CategoryDAO.php+++ b/app/Models/CategoryDAO.php@@ -226,7 +226,7 @@ SQL;$sql = 'SELECT id, name, kind, `lastUpdate`, error, attributes FROM `_category`';$stm = $this->pdo->query($sql);if ($stm !== false) {- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {/** @var array{id:int,name:string,kind:int,lastUpdate:int,error:int,attributes?:array<string,mixed>} $row */yield $row;}diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.phpindex a234dce91..f6c327364 100644--- a/app/Models/EntryDAO.php+++ b/app/Models/EntryDAO.php@@ -748,8 +748,8 @@ SQL;$sql .= ' ORDER BY id DESC LIMIT ' . $limit;}$stm = $this->pdo->query($sql);- if ($stm != false) {- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {+ if ($stm !== false) {+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {/** @var array{id:string,guid:string,title:string,author:string,content:string,link:string,date:int,lastSeen:int,* hash:string,is_read:bool,is_favorite:bool,id_feed:int,tags:string,attributes:?string} $row */yield $row;@@ -1394,12 +1394,10 @@ SQL;$stm = $this->listWhereRaw($type, $id, $state, $filters, id_min: $id_min, id_max: $id_max, sort: $sort, order: $order,continuation_id: $continuation_id, continuation_value: $continuation_value, limit: $limit, offset: $offset);if ($stm !== false) {- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {- if (is_array($row)) {- /** @var array{'id':string,'id_feed':int,'guid':string,'title':string,'author':string,'content':string,'link':string,'date':int,- * 'hash':string,'is_read':int,'is_favorite':int,'tags':string,'attributes'?:?string} $row */- yield FreshRSS_Entry::fromArray($row);- }+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {+ /** @var array{'id':string,'id_feed':int,'guid':string,'title':string,'author':string,'content':string,'link':string,'date':int,+ * 'hash':string,'is_read':int,'is_favorite':int,'tags':string,'attributes'?:?string} $row */+ yield FreshRSS_Entry::fromArray($row);}}}@@ -1438,12 +1436,10 @@ SQL;if ($stm === false || !$stm->execute($ids)) {return;}- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {- if (is_array($row)) {- /** @var array{'id':string,'id_feed':int,'guid':string,'title':string,'author':string,'content':string,'link':string,'date':int,- * 'hash':string,'is_read':int,'is_favorite':int,'tags':string,'attributes':?string} $row */- yield FreshRSS_Entry::fromArray($row);- }+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {+ /** @var array{'id':string,'id_feed':int,'guid':string,'title':string,'author':string,'content':string,'link':string,'date':int,+ * 'hash':string,'is_read':int,'is_favorite':int,'tags':string,'attributes':?string} $row */+ yield FreshRSS_Entry::fromArray($row);}}diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.phpindex 6b5f7f96a..464d3fe06 100644--- a/app/Models/FeedDAO.php+++ b/app/Models/FeedDAO.php@@ -305,7 +305,7 @@ FROM `_feed`SQL;$stm = $this->pdo->query($sql);if ($stm !== false) {- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {/** @var array{id:int,url:string,kind:int,category:int,name:string,website:string,description:string,lastUpdate:int,priority?:int,* pathEntries?:string,httpAuth:string,error:int|bool,ttl?:int,attributes?:string} $row */yield $row;diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.phpindex c2a653238..65e322d5a 100644--- a/app/Models/TagDAO.php+++ b/app/Models/TagDAO.php@@ -125,7 +125,7 @@ SQL;Minz_Log::error('SQL error ' . __METHOD__ . json_encode($this->pdo->errorInfo()));return;}- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {/** @var array{id:int,name:string,attributes?:array<string,mixed>} $row */yield $row;}@@ -139,7 +139,7 @@ SQL;Minz_Log::error('SQL error ' . __METHOD__ . json_encode($this->pdo->errorInfo()));return;}- while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {+ while (is_array($row = $stm->fetch(PDO::FETCH_ASSOC))) {/** @var array{id_tag:int,id_entry:int|numeric-string}> $row */yield $row; // @phpstan-ignore generator.valueType}diff --git a/composer.json b/composer.jsonindex 46b96abc8..3336d9520 100644--- a/composer.json+++ b/composer.json@@ -61,7 +61,7 @@"phpstan/phpstan-phpunit": "^2.0","phpstan/phpstan-strict-rules": "^2.0","phpunit/phpunit": "^10",- "squizlabs/php_codesniffer": "^3.11"+ "squizlabs/php_codesniffer": "^3.12"},"scripts": {"php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",diff --git a/composer.lock b/composer.lockindex 68e3562d1..90d2ab00c 100644--- a/composer.lock+++ b/composer.lock@@ -4,7 +4,7 @@"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies","This file is @generated automatically"],- "content-hash": "7e35e91a225d5fe5dcfff3f996c53981",+ "content-hash": "ee7c803dd30082ceb74bfc07be138045","packages": [],"packages-dev": [{@@ -356,16 +356,16 @@},{"name": "phpstan/phpstan-strict-rules",- "version": "2.0.3",+ "version": "2.0.4","source": {"type": "git","url": "https://github.com/phpstan/phpstan-strict-rules.git",- "reference": "8b88b5f818bfa301e0c99154ab622dace071c3ba"+ "reference": "3e139cbe67fafa3588e1dbe27ca50f31fdb6236a"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/8b88b5f818bfa301e0c99154ab622dace071c3ba",- "reference": "8b88b5f818bfa301e0c99154ab622dace071c3ba",+ "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/3e139cbe67fafa3588e1dbe27ca50f31fdb6236a",+ "reference": "3e139cbe67fafa3588e1dbe27ca50f31fdb6236a","shasum": ""},"require": {@@ -398,9 +398,9 @@"description": "Extra strict and opinionated rules for PHPStan","support": {"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",- "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.3"+ "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.4"},- "time": "2025-01-21T10:52:14+00:00"+ "time": "2025-03-18T11:42:40+00:00"},{"name": "phpunit/php-code-coverage",@@ -1912,5 +1912,5 @@"platform-overrides": {"php": "8.1"},- "plugin-api-version": "2.3.0"+ "plugin-api-version": "2.6.0"}