Pass phpstan-strict-rules 2.0.4 (#7488)

New check for Boolean in while conditions
Replace https://github.com/FreshRSS/FreshRSS/pull/7481
This commit is contained in:
Alexandre Alapetite authored and GitHub committed 2025-04-02 00:46:28 +02:00
1 parent ca2693441c
commit 78dfb44060
6 files changed
+23 -27

No files matched your search

+1 -1
View File
@@ -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;
}
+10 -14
View File
@@ -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);
}
}
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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
}