aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-04-02 00:46:28 +0200
committerGravatar GitHub <noreply@github.com> 2025-04-02 00:46:28 +0200
commit78dfb44060921a15f820d5794efcf2898f4333c2 (patch)
tree82547cf584bc055b6382fe472e40ff357456d54f
parentca2693441c531f96389c49c9240b4239f0006de5 (diff)
Pass phpstan-strict-rules 2.0.4 (#7488)
New check for Boolean in while conditions Replace https://github.com/FreshRSS/FreshRSS/pull/7481
-rw-r--r--app/Models/CategoryDAO.php2
-rw-r--r--app/Models/EntryDAO.php24
-rw-r--r--app/Models/FeedDAO.php2
-rw-r--r--app/Models/TagDAO.php4
-rw-r--r--composer.json2
-rw-r--r--composer.lock16
6 files changed, 23 insertions, 27 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 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.php
index 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.php
index 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.php
index 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.json
index 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.lock
index 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"
}