Skip to content

A free, self-hostable news aggregator…

Fix PHPStan 2.2.7 (#9156)

Alexandre Alapetite1dced38fc187
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 615a78bfe..d75e48f52 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -1731,9 +1731,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
if ($stm !== false) {
foreach ($values as $index => $value) {
$paramType = PDO::PARAM_STR;
- if (is_null($value)) {
+ if (is_null($value)) { // @phpstan-ignore function.impossibleType (defensive)
$paramType = PDO::PARAM_NULL;
- } elseif (is_int($value) || is_bool($value)) {
+ } elseif (is_int($value) || is_bool($value)) { // @phpstan-ignore function.impossibleType (defensive)
$paramType = PDO::PARAM_INT;
}
$stm->bindValue($index + 1, $value, $paramType);
diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php
index 5eddbd972..f50f7d61a 100644
--- a/app/Services/ImportService.php
+++ b/app/Services/ImportService.php
@@ -426,7 +426,8 @@ class FreshRSS_Import_Service {
$categories_elements = array_merge($categories_elements, $outline_categories);
foreach ($outline_categories_to_feeds as $category_name => $feeds) {
- if (!is_string($category_name) || !is_array($feeds)) {
+ if (!is_string($category_name) || // @phpstan-ignore function.alreadyNarrowedType (defensive)
+ !is_array($feeds)) { // @phpstan-ignore function.alreadyNarrowedType (defensive)
continue;
}
if (!isset($categories_to_feeds[$category_name])) {
diff --git a/composer.lock b/composer.lock
index 327762637..59fa6af87 100644
--- a/composer.lock
+++ b/composer.lock
@@ -69,20 +69,19 @@
},
{
"name": "nikic/php-parser",
- "version": "v5.7.0",
+ "version": "v5.8.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"
+ "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",
- "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
+ "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
"shasum": ""
},
"require": {
- "ext-ctype": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.4"
@@ -121,9 +120,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
- "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0"
},
- "time": "2025-12-06T11:56:16+00:00"
+ "time": "2026-07-04T14:30:18+00:00"
},
{
"name": "phar-io/manifest",
@@ -245,11 +244,11 @@
},
{
"name": "phpstan/phpstan",
- "version": "2.2.3",
+ "version": "2.2.7",
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4048833dd47b377287818841877fb3087289509c",
- "reference": "4048833dd47b377287818841877fb3087289509c",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/692db47b9dddb0487934e5236e77d48594aef921",
+ "reference": "692db47b9dddb0487934e5236e77d48594aef921",
"shasum": ""
},
"require": {
@@ -305,20 +304,20 @@
"type": "github"
}
],
- "time": "2026-06-30T21:15:26+00:00"
+ "time": "2026-07-29T17:39:32+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",
- "version": "2.0.4",
+ "version": "2.0.5",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
- "reference": "6b5571001a7f04fa0422254c30a0017ec2f2cacc"
+ "reference": "67bedd65c24bc72840afc45aed48b1059dd44bec"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/6b5571001a7f04fa0422254c30a0017ec2f2cacc",
- "reference": "6b5571001a7f04fa0422254c30a0017ec2f2cacc",
+ "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/67bedd65c24bc72840afc45aed48b1059dd44bec",
+ "reference": "67bedd65c24bc72840afc45aed48b1059dd44bec",
"shasum": ""
},
"require": {
@@ -328,7 +327,8 @@
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^2.0",
- "phpunit/phpunit": "^9.6"
+ "phpunit/phpunit": "^9.6",
+ "shipmonk/name-collision-detector": "^2.1"
},
"type": "phpstan-extension",
"extra": {
@@ -353,22 +353,22 @@
],
"support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
- "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.4"
+ "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.5"
},
- "time": "2026-02-09T13:21:14+00:00"
+ "time": "2026-07-22T06:50:43+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
- "version": "2.0.17",
+ "version": "2.0.18",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git",
- "reference": "c2f977551f0736d60467b3d754b2e0cf4e337b3f"
+ "reference": "f5dc20ff8082d02339b60cab68ec3eb0d859fb30"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/c2f977551f0736d60467b3d754b2e0cf4e337b3f",
- "reference": "c2f977551f0736d60467b3d754b2e0cf4e337b3f",
+ "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f5dc20ff8082d02339b60cab68ec3eb0d859fb30",
+ "reference": "f5dc20ff8082d02339b60cab68ec3eb0d859fb30",
"shasum": ""
},
"require": {
@@ -411,33 +411,34 @@
],
"support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues",
- "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.17"
+ "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.18"
},
- "time": "2026-06-29T05:32:23+00:00"
+ "time": "2026-07-04T12:16:09+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
- "version": "2.0.11",
+ "version": "2.0.12",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
- "reference": "9b000a578b85b32945b358b172c7b20e91189024"
+ "reference": "2bc5ae19ae965663b62ac907ee6342c3903ec93b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/9b000a578b85b32945b358b172c7b20e91189024",
- "reference": "9b000a578b85b32945b358b172c7b20e91189024",
+ "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/2bc5ae19ae965663b62ac907ee6342c3903ec93b",
+ "reference": "2bc5ae19ae965663b62ac907ee6342c3903ec93b",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
- "phpstan/phpstan": "^2.1.39"
+ "phpstan/phpstan": "^2.1.52"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
- "phpunit/phpunit": "^9.6"
+ "phpunit/phpunit": "^9.6",
+ "shipmonk/name-collision-detector": "^2.1"
},
"type": "phpstan-extension",
"extra": {
@@ -462,9 +463,9 @@
],
"support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
- "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.11"
+ "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.12"
},
- "time": "2026-05-02T06:54:10+00:00"
+ "time": "2026-07-19T07:24:06+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -789,24 +790,24 @@
},
{
"name": "phpunit/phpunit",
- "version": "10.5.63",
+ "version": "10.5.64",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "33198268dad71e926626b618f3ec3966661e4d90"
+ "reference": "0e8c1d19cea35ad97d4887f363d07c78e30fbf06"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33198268dad71e926626b618f3ec3966661e4d90",
- "reference": "33198268dad71e926626b618f3ec3966661e4d90",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e8c1d19cea35ad97d4887f363d07c78e30fbf06",
+ "reference": "0e8c1d19cea35ad97d4887f363d07c78e30fbf06",
"shasum": ""
},
"require": {
"ext-dom": "*",
+ "ext-filter": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
- "ext-xml": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.13.4",
"phar-io/manifest": "^2.0.4",
@@ -870,31 +871,15 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.63"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.64"
},
"funding": [
{
- "url": "https://phpunit.de/sponsors.html",
- "type": "custom"
- },
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- },
- {
- "url": "https://liberapay.com/sebastianbergmann",
- "type": "liberapay"
- },
- {
- "url": "https://thanks.dev/u/gh/sebastianbergmann",
- "type": "thanks_dev"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
- "type": "tidelift"
+ "url": "https://phpunit.de/sponsoring.html",
+ "type": "other"
}
],
- "time": "2026-01-27T05:48:37+00:00"
+ "time": "2026-07-06T14:50:35+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -1981,7 +1966,7 @@
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {},
+ "stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@@ -2016,5 +2001,5 @@
"platform-overrides": {
"php": "8.1"
},
- "plugin-api-version": "2.9.0"
+ "plugin-api-version": "2.6.0"
}
diff --git a/p/api/fever.php b/p/api/fever.php
index 7a6dcc290..63171c993 100644
--- a/p/api/fever.php
+++ b/p/api/fever.php
@@ -497,8 +497,8 @@ final class FeverAPI
if (is_string($_REQUEST['feed_ids'] ?? null)) {
$feed_ids = array_filter(explode(',', $_REQUEST['feed_ids']), 'ctype_digit');
} elseif (is_string($_REQUEST['group_ids'] ?? null)) {
- $categoryDAO = FreshRSS_Factory::createCategoryDao();
$group_ids = explode(',', $_REQUEST['group_ids']);
+ $categoryDAO = FreshRSS_Factory::createCategoryDao();
$feeds = [];
foreach ($group_ids as $id) {
if (!is_numeric($id)) {