Sfoglia il codice sorgente

Update code for PHPStan 2.3.7 (#9681)

Alexandre Alapetite 13 ore fa
parent
commit
0f0d4622c6

+ 0 - 3
app/Models/BooleanSearch.php

@@ -82,9 +82,6 @@ class FreshRSS_BooleanSearch implements \Stringable {
 			$fromS = [];
 			$toS = [];
 			foreach ($all_matches as $matches) {
-				if (empty($matches['search'])) {
-					continue;
-				}
 				for ($i = count($matches['search']) - 1; $i >= 0; $i--) {
 					$name = trim($matches['search'][$i]);
 					$name = self::unescapeLiterals($name);

+ 2 - 1
app/Models/CategoryDAO.php

@@ -341,7 +341,8 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
 				ORDER BY c.name, f.name
 				SQL;
 			$stm = $this->pdo->prepare($sql);
-			if ($stm !== false && $stm->execute() && ($res = $stm->fetchAll(PDO::FETCH_ASSOC)) !== false) {
+			if ($stm !== false && $stm->execute()) {
+				$res = $stm->fetchAll(PDO::FETCH_ASSOC);
 				/** @var list<array{c_name:string,c_id:int,c_kind:int,c_last_update:int,c_error:int,c_attributes?:string,
 				 * 	id?:int,name?:string,url?:string,kind?:int,category?:int,website?:string,priority?:int,error?:int,attributes?:string,cache_nbEntries?:int,cache_nbUnreads?:int,ttl?:int}> $res */
 				return self::daoToCategoriesPrepopulated($res);

+ 1 - 7
app/Models/DatabaseDAO.php

@@ -59,13 +59,7 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo {
 			SELECT * FROM `_entry` LIMIT 1
 			SQL;
 		$stm = $this->pdo->query($sql);
-		if ($stm !== false) {
-			$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
-			if ($res !== false) {
-				return true;
-			}
-		}
-		return false;
+		return $stm !== false;
 	}
 
 	public function tablesAreCorrect(): bool {

+ 1 - 3
app/Models/Feed.php

@@ -1218,9 +1218,7 @@ class FreshRSS_Feed extends Minz_Model {
 				if ($item['title'] != '' || $item['content'] != '' || $item['link'] != '') {
 					// HTML-encoding/escaping of the relevant fields (all except 'content')
 					foreach (['author', 'guid', 'link', 'thumbnail', 'timestamp', 'title'] as $key) {
-						if (isset($item[$key])) {
-							$item[$key] = htmlspecialchars($item[$key], ENT_COMPAT, 'UTF-8');
-						}
+						$item[$key] = htmlspecialchars($item[$key], ENT_COMPAT, 'UTF-8');
 					}
 					if (isset($item['tags'])) {
 						$item['tags'] = Minz_Helper::htmlspecialchars_utf8($item['tags']);

+ 2 - 1
app/Models/FeedDAO.php

@@ -463,7 +463,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
 				SQL;
 		}
 		$stm = $this->pdo->query($sql);
-		if ($stm !== false && ($res = $stm->fetchAll(PDO::FETCH_ASSOC)) !== false) {
+		if ($stm !== false) {
+			$res = $stm->fetchAll(PDO::FETCH_ASSOC);
 			/** @var list<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,ttl?:int,attributes?:string,cache_nbUnreads?:int,cache_nbEntries?:int}> $res */
 			return self::daoToFeeds($res);

+ 1 - 1
app/Models/FilterAction.php

@@ -31,7 +31,7 @@ class FreshRSS_FilterAction {
 
 	/** @return array{search?:string,actions?:array<string>} */
 	public function toJSON(): array {
-		if (is_array($this->actions) && $this->booleanSearch != null) {
+		if (is_array($this->actions)) {
 			return [
 				'search' => $this->booleanSearch->toString(expandUserQueries: false),
 				'actions' => $this->actions,

+ 38 - 38
composer.lock

@@ -69,16 +69,16 @@
         },
         {
             "name": "nikic/php-parser",
-            "version": "v5.9.0",
+            "version": "v5.10.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/nikic/PHP-Parser.git",
-                "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def"
+                "reference": "95d3450d7b8421795182fb4e310aa3c949423fa7"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def",
-                "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def",
+                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/95d3450d7b8421795182fb4e310aa3c949423fa7",
+                "reference": "95d3450d7b8421795182fb4e310aa3c949423fa7",
                 "shasum": ""
             },
             "require": {
@@ -120,9 +120,9 @@
             ],
             "support": {
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
-                "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0"
+                "source": "https://github.com/nikic/PHP-Parser/tree/v5.10.0"
             },
-            "time": "2026-09-13T18:51:52+00:00"
+            "time": "2026-11-28T17:47:43+00:00"
         },
         {
             "name": "phar-io/manifest",
@@ -244,11 +244,11 @@
         },
         {
             "name": "phpstan/phpstan",
-            "version": "2.3.2",
+            "version": "2.3.7",
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/18bc23a0682f08591529377d271b5c4dfe9ed1dd",
-                "reference": "18bc23a0682f08591529377d271b5c4dfe9ed1dd",
+                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/90c91c2498849ab8cc4e873864bbf1cb2bf6ea12",
+                "reference": "90c91c2498849ab8cc4e873864bbf1cb2bf6ea12",
                 "shasum": ""
             },
             "require": {
@@ -304,25 +304,25 @@
                     "type": "github"
                 }
             ],
-            "time": "2026-10-24T11:36:00+00:00"
+            "time": "2026-11-19T10:31:11+00:00"
         },
         {
             "name": "phpstan/phpstan-deprecation-rules",
-            "version": "2.0.5",
+            "version": "2.0.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
-                "reference": "67bedd65c24bc72840afc45aed48b1059dd44bec"
+                "reference": "bcb050f0a5c923798ff408926ec5f9b9b59faafc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/67bedd65c24bc72840afc45aed48b1059dd44bec",
-                "reference": "67bedd65c24bc72840afc45aed48b1059dd44bec",
+                "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/bcb050f0a5c923798ff408926ec5f9b9b59faafc",
+                "reference": "bcb050f0a5c923798ff408926ec5f9b9b59faafc",
                 "shasum": ""
             },
             "require": {
                 "php": "^7.4 || ^8.0",
-                "phpstan/phpstan": "^2.1.39"
+                "phpstan/phpstan": "^2.3.6"
             },
             "require-dev": {
                 "php-parallel-lint/php-parallel-lint": "^1.2",
@@ -353,28 +353,28 @@
             ],
             "support": {
                 "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
-                "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.5"
+                "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.6"
             },
-            "time": "2026-07-22T06:50:43+00:00"
+            "time": "2026-11-23T08:55:59+00:00"
         },
         {
             "name": "phpstan/phpstan-phpunit",
-            "version": "2.1.1",
+            "version": "2.1.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpstan-phpunit.git",
-                "reference": "8d16b8478e523a47f8c02e83bce8981b5b5a3b03"
+                "reference": "80d6e8edd4d0e24c7dea617b9f6eedf2ed3f5099"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/8d16b8478e523a47f8c02e83bce8981b5b5a3b03",
-                "reference": "8d16b8478e523a47f8c02e83bce8981b5b5a3b03",
+                "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/80d6e8edd4d0e24c7dea617b9f6eedf2ed3f5099",
+                "reference": "80d6e8edd4d0e24c7dea617b9f6eedf2ed3f5099",
                 "shasum": ""
             },
             "require": {
                 "phar-io/version": "^3.2",
                 "php": "^7.4 || ^8.0",
-                "phpstan/phpstan": "^2.3.0"
+                "phpstan/phpstan": "^2.3.6"
             },
             "conflict": {
                 "phpunit/phpunit": "<7.0"
@@ -411,22 +411,22 @@
             ],
             "support": {
                 "issues": "https://github.com/phpstan/phpstan-phpunit/issues",
-                "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.1.1"
+                "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.1.6"
             },
-            "time": "2026-10-06T18:12:32+00:00"
+            "time": "2026-12-01T08:02:02+00:00"
         },
         {
             "name": "phpstan/phpstan-strict-rules",
-            "version": "2.1.0",
+            "version": "2.1.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpstan-strict-rules.git",
-                "reference": "24ec51589f896f048d0d36de373d993b5cf71786"
+                "reference": "c250a77b36059007de360f28522f0e7b687b8572"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/24ec51589f896f048d0d36de373d993b5cf71786",
-                "reference": "24ec51589f896f048d0d36de373d993b5cf71786",
+                "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/c250a77b36059007de360f28522f0e7b687b8572",
+                "reference": "c250a77b36059007de360f28522f0e7b687b8572",
                 "shasum": ""
             },
             "require": {
@@ -463,9 +463,9 @@
             ],
             "support": {
                 "issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
-                "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.1.0"
+                "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.1.2"
             },
-            "time": "2026-10-01T21:30:37+00:00"
+            "time": "2026-11-23T09:01:11+00:00"
         },
         {
             "name": "phpunit/php-code-coverage",
@@ -816,16 +816,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "11.5.57",
+            "version": "11.5.58",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "36b75bf56a8535623f5b3e24b27ea1823759da1a"
+                "reference": "c14b3145a2fcfa5dd9b25ee999ce2ba5933adf6f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/36b75bf56a8535623f5b3e24b27ea1823759da1a",
-                "reference": "36b75bf56a8535623f5b3e24b27ea1823759da1a",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c14b3145a2fcfa5dd9b25ee999ce2ba5933adf6f",
+                "reference": "c14b3145a2fcfa5dd9b25ee999ce2ba5933adf6f",
                 "shasum": ""
             },
             "require": {
@@ -898,7 +898,7 @@
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.57"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.58"
             },
             "funding": [
                 {
@@ -906,7 +906,7 @@
                     "type": "other"
                 }
             ],
-            "time": "2026-10-05T05:47:54+00:00"
+            "time": "2026-11-13T11:08:08+00:00"
         },
         {
             "name": "sebastian/cli-parser",
@@ -2083,7 +2083,7 @@
     ],
     "aliases": [],
     "minimum-stability": "stable",
-    "stability-flags": {},
+    "stability-flags": [],
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": {
@@ -2117,5 +2117,5 @@
     "platform-overrides": {
         "php": "8.2"
     },
-    "plugin-api-version": "2.11.0"
+    "plugin-api-version": "2.6.0"
 }

+ 1 - 1
lib/Minz/Migrator.php

@@ -139,7 +139,7 @@ class Minz_Migrator
 			$migration_callback = $migration_class . '::migrate';
 
 			$include_result = @include_once $filepath;
-			if (!$include_result) {
+			if ($include_result === false) {
 				Minz_Log::error(
 					"{$filepath} migration file cannot be loaded.",
 					ADMIN_LOG

+ 1 - 1
lib/http-conditional.php

@@ -209,7 +209,7 @@ function httpConditionalRefresh(int $UnixTimeStamp): void {
 	if (is_string($_SERVER['QUERY_STRING'] ?? null)) $myQuery = '?' . $_SERVER['QUERY_STRING'];
 	else $myQuery = '';
 	global $_sessionMode;
-	if ($_sessionMode && isset($_SESSION))
+	if (!empty($_sessionMode) && isset($_SESSION))
 		$myQuery .= print_r($_SESSION, true) . session_name() . '=' . session_id();
 	$etagServer = '"' . md5($scriptName . $myQuery . '#' . $dateLastModif) . '"';
 

+ 2 - 1
p/api/greader.php

@@ -46,7 +46,8 @@ if (PHP_INT_SIZE < 8) {	//32-bit
 		if (!ctype_xdigit($hex)) {
 			return '0';
 		}
-		return '' . hexdec($hex);
+		$dec = '' . hexdec($hex);
+		return is_numeric($dec) ? $dec : '0';
 	}
 }
 

+ 1 - 1
p/f.php

@@ -19,7 +19,7 @@ $no_cache = file_exists(DATA_PATH . '/no-cache.txt');
 function show_default_favicon(int $cacheSeconds = 3600): void {
 	global $no_cache;
 	$default_mtime = @filemtime(DEFAULT_FAVICON) ?: 0;
-	if ($no_cache || !httpConditional($default_mtime, $cacheSeconds, 2)) {
+	if (!empty($no_cache) || !httpConditional($default_mtime, $cacheSeconds, 2)) {
 		header('Content-Type: image/x-icon');
 		header('Content-Disposition: attachment; filename="default_favicon.ico"');
 		readfile(DEFAULT_FAVICON);