From e0b116f904d50f71a8d8842f1aabd6bc609f6c9b Mon Sep 17 00:00:00 2001 From: supahgreg Date: Sun, 5 Oct 2025 20:51:13 +0000 Subject: Bump PHPStan to 2.1.30 and address new findings. Also some minor adjacent cleanup. --- classes/Feeds.php | 4 +-- classes/RSSUtils.php | 55 ++++++++++++++------------------ composer.json | 2 +- composer.lock | 15 +++------ vendor/composer/installed.json | 15 +++------ vendor/composer/installed.php | 18 +++++------ vendor/phpstan/phpstan/README.md | 38 ++++++++++++++-------- vendor/phpstan/phpstan/bootstrap.php | 10 ++++++ vendor/phpstan/phpstan/composer.json | 5 +++ vendor/phpstan/phpstan/phpstan.phar | Bin 24045381 -> 25377389 bytes vendor/phpstan/phpstan/phpstan.phar.asc | 26 +++++++-------- 11 files changed, 97 insertions(+), 91 deletions(-) diff --git a/classes/Feeds.php b/classes/Feeds.php index 4f124f42c..a33bb160f 100644 --- a/classes/Feeds.php +++ b/classes/Feeds.php @@ -356,9 +356,7 @@ class Feeds extends Handler_Protected { } } - if (isset($rgba_cache[$feed_id])) { - $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; - } + $line['feed_bg_color'] = 'rgba(' . implode(',', $rgba_cache[$feed_id]) . ',0.3)'; PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_CDM, function ($result, $plugin) use (&$line) { diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php index c4a6af548..c169906d7 100644 --- a/classes/RSSUtils.php +++ b/classes/RSSUtils.php @@ -1458,11 +1458,11 @@ class RSSUtils { $last_processed_rule = false; $regexp_matches = []; + /** @var array{reg_exp: string, type: string, inverse: bool} $rule */ foreach ($filter["rules"] as $rule) { $match = false; $reg_exp = str_replace('/', '\/', (string)$rule["reg_exp"]); $reg_exp = str_replace("\n", "", $reg_exp); // reg_exp may be formatted with CRs now because of textarea, we need to strip those - $rule_inverse = $rule["inverse"] ?? false; $last_processed_rule = $rule; if (empty($reg_exp)) @@ -1503,7 +1503,8 @@ class RSSUtils { break; } - if ($rule_inverse) $match = !$match; + if ($rule['inverse']) + $match = !$match; if ($match_any_rule) { if ($match) { @@ -1863,13 +1864,11 @@ class RSSUtils { $match_on = json_decode($rule_line["match_on"], true); if (in_array("0", $match_on) || in_array($feed_id, $match_on) || count(array_intersect($check_cats_fullids, $match_on)) > 0) { - - $rule = array(); - $rule["reg_exp"] = $rule_line["reg_exp"]; - $rule["type"] = $rule_line["type_name"]; - $rule["inverse"] = sql_bool_to_bool($rule_line["inverse"]); - - array_push($rules, $rule); + array_push($rules, [ + 'reg_exp' => $rule_line['reg_exp'], + 'type' => $rule_line['type_name'], + 'inverse' => sql_bool_to_bool($rule_line['inverse']), + ]); } else if (!$match_any_rule) { // this filter contains a rule that doesn't match to this feed/category combination // thus filter has to be rejected @@ -1879,13 +1878,11 @@ class RSSUtils { } } else { - - $rule = array(); - $rule["reg_exp"] = $rule_line["reg_exp"]; - $rule["type"] = $rule_line["type_name"]; - $rule["inverse"] = sql_bool_to_bool($rule_line["inverse"]); - - array_push($rules, $rule); + array_push($rules, [ + 'reg_exp' => $rule_line['reg_exp'], + 'type' => $rule_line['type_name'], + 'inverse' => sql_bool_to_bool($rule_line['inverse']), + ]); } } @@ -1898,25 +1895,21 @@ class RSSUtils { $sth2->execute([$filter_id]); while ($action_line = $sth2->fetch()) { - # print_r($action_line); - - $action = array(); - $action["type"] = $action_line["type_name"]; - $action["param"] = $action_line["action_param"]; - - array_push($actions, $action); + array_push($actions, [ + 'type' => $action_line['type_name'], + 'param' => $action_line['action_param'], + ]); } } - $filter = []; - $filter["id"] = $filter_id; - $filter["match_any_rule"] = sql_bool_to_bool($line["match_any_rule"]); - $filter["inverse"] = sql_bool_to_bool($line["inverse"]); - $filter["rules"] = $rules; - $filter["actions"] = $actions; - if (count($rules) > 0 && count($actions) > 0) { - array_push($filters, $filter); + array_push($filters, [ + 'id' => $filter_id, + 'match_any_rule' => sql_bool_to_bool($line['match_any_rule']), + 'inverse' => sql_bool_to_bool($line['inverse']), + 'rules' => $rules, + 'actions' => $actions, + ]); } } diff --git a/composer.json b/composer.json index 784280ea9..24c2a34d6 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "dragonmantank/cron-expression": "^3.4" }, "require-dev": { - "phpstan/phpstan": "2.1.13", + "phpstan/phpstan": "2.1.30", "phpunit/phpunit": "9.5.16", "phpunit/php-code-coverage": "^9.2" } diff --git a/composer.lock b/composer.lock index 7587c2cdb..faf82fa52 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": "6275e0932b09f1cf029085d4db0d80b5", + "content-hash": "64a30196cdb101db290fd303c1b55956", "packages": [ { "name": "chillerlan/php-qrcode", @@ -1771,16 +1771,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.13", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "e55e03e6d4ac49cd1240907e5b08e5cd378572a9" - }, + "version": "2.1.30", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e55e03e6d4ac49cd1240907e5b08e5cd378572a9", - "reference": "e55e03e6d4ac49cd1240907e5b08e5cd378572a9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a4a7f159927983dd4f7c8020ed227d80b7f39d7d", + "reference": "a4a7f159927983dd4f7c8020ed227d80b7f39d7d", "shasum": "" }, "require": { @@ -1825,7 +1820,7 @@ "type": "github" } ], - "time": "2025-04-27T12:28:25+00:00" + "time": "2025-10-02T16:07:52+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index a19552494..7c591137f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1303,17 +1303,12 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.13", - "version_normalized": "2.1.13.0", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "e55e03e6d4ac49cd1240907e5b08e5cd378572a9" - }, + "version": "2.1.30", + "version_normalized": "2.1.30.0", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e55e03e6d4ac49cd1240907e5b08e5cd378572a9", - "reference": "e55e03e6d4ac49cd1240907e5b08e5cd378572a9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a4a7f159927983dd4f7c8020ed227d80b7f39d7d", + "reference": "a4a7f159927983dd4f7c8020ed227d80b7f39d7d", "shasum": "" }, "require": { @@ -1322,7 +1317,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2025-04-27T12:28:25+00:00", + "time": "2025-10-02T16:07:52+00:00", "bin": [ "phpstan", "phpstan.phar" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 9a3c4ccfc..77067307d 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => '__root__', - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => 'f7fc00326e2f51f269f26b24a54d34e07a36846e', + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => 'ec367b23f4e7d6a127e80b918ef28c61172cff6e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( '__root__' => array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => 'f7fc00326e2f51f269f26b24a54d34e07a36846e', + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => 'ec367b23f4e7d6a127e80b918ef28c61172cff6e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -190,9 +190,9 @@ 'dev_requirement' => true, ), 'phpstan/phpstan' => array( - 'pretty_version' => '2.1.13', - 'version' => '2.1.13.0', - 'reference' => 'e55e03e6d4ac49cd1240907e5b08e5cd378572a9', + 'pretty_version' => '2.1.30', + 'version' => '2.1.30.0', + 'reference' => 'a4a7f159927983dd4f7c8020ed227d80b7f39d7d', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), diff --git a/vendor/phpstan/phpstan/README.md b/vendor/phpstan/phpstan/README.md index abae67ecf..49bed4fd7 100644 --- a/vendor/phpstan/phpstan/README.md +++ b/vendor/phpstan/phpstan/README.md @@ -24,11 +24,29 @@ can be checked before you run the actual line. ## Sponsors +Want your logo here? [Learn more ยป](https://phpstan.org/sponsor) + +### Gold Sponsors + +Matt Mullenweg +Mojam + +

+ +### Silver Sponsors + +ShipMonk +Shopware + +

+ +### Bronze Sponsors + TheCodingMachine     Private Packagist
-CDN77 +CDN77     Blackfire.io
@@ -36,23 +54,23 @@ can be checked before you run the actual line.     Fame Helsinki
-ShipMonk +Belsimpel     Togetter
RightCapital     -ContentKing +Shoptet
ZOL     EdgeNext
-Shopware +Route4Me: Route Optimizer and Route Planner Software     Craft CMS
-Worksome +TicketSwap     campoint AG
@@ -60,18 +78,10 @@ can be checked before you run the actual line.     Inviqa
-Shoptet -    -Route4Me: Route Optimizer and Route Planner Software -
-Belsimpel -    -TicketSwap -[**You can now sponsor my open-source work on PHPStan through GitHub Sponsors.**](https://github.com/sponsors/ondrejmirtes) -Does GitHub already have your ๐Ÿ’ณ? Do you use PHPStan to find ๐Ÿ› before they reach production? [Send a couple of ๐Ÿ’ธ a month my way too.](https://github.com/sponsors/ondrejmirtes) Thank you! +[**You can sponsor my open-source work on PHPStan through GitHub Sponsors and also directly.**](https://phpstan.org/sponsor) One-time donations [through Revolut.me](https://revolut.me/ondrejmirtes) are also accepted. To request an invoice, [contact me](mailto:ondrej@mirtes.cz) through e-mail. diff --git a/vendor/phpstan/phpstan/bootstrap.php b/vendor/phpstan/phpstan/bootstrap.php index a5d341bfd..ac3e269c1 100644 --- a/vendor/phpstan/phpstan/bootstrap.php +++ b/vendor/phpstan/phpstan/bootstrap.php @@ -92,6 +92,16 @@ final class PharAutoloader require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/Php81.php'; require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/bootstrap.php'; } + + if ( + PHP_VERSION_ID < 80300 + && empty ($GLOBALS['__composer_autoload_files']['662a729f963d39afe703c9d9b7ab4a8c']) + && !class_exists(\Symfony\Polyfill\Php83\Php83::class, false) + ) { + $GLOBALS['__composer_autoload_files']['662a729f963d39afe703c9d9b7ab4a8c'] = true; + require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php83/Php83.php'; + require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php83/bootstrap.php'; + } } $filename = str_replace('\\', DIRECTORY_SEPARATOR, $class); diff --git a/vendor/phpstan/phpstan/composer.json b/vendor/phpstan/phpstan/composer.json index dc62c19ce..8b51d4b71 100644 --- a/vendor/phpstan/phpstan/composer.json +++ b/vendor/phpstan/phpstan/composer.json @@ -16,6 +16,11 @@ "autoload": { "files": ["bootstrap.php"] }, + "source": { + "type": "", + "url": "", + "reference": "" + }, "support": { "issues": "https://github.com/phpstan/phpstan/issues", "forum": "https://github.com/phpstan/phpstan/discussions", diff --git a/vendor/phpstan/phpstan/phpstan.phar b/vendor/phpstan/phpstan/phpstan.phar index 06c6b48a6..22c71170f 100755 Binary files a/vendor/phpstan/phpstan/phpstan.phar and b/vendor/phpstan/phpstan/phpstan.phar differ diff --git a/vendor/phpstan/phpstan/phpstan.phar.asc b/vendor/phpstan/phpstan/phpstan.phar.asc index c6acfbe08..0266aaa00 100644 --- a/vendor/phpstan/phpstan/phpstan.phar.asc +++ b/vendor/phpstan/phpstan/phpstan.phar.asc @@ -1,16 +1,16 @@ -----BEGIN PGP SIGNATURE----- -iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmgOIscACgkQUcZzBf/C -5cBGzA//Wya23VZ7JBZM3RNR4g4d3ez39/BIa5XBHAF1Hpm9dmliDlME6R73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