Bump PHPStan to 2.1.30 and address new findings.

Also some minor adjacent cleanup.
This commit is contained in:
supahgreg
2025-10-05 20:51:13 +00:00
parent ec367b23f4
commit e0b116f904
11 changed files with 97 additions and 91 deletions

View File

@@ -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) {

View File

@@ -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,
]);
}
}

View File

@@ -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"
}

15
composer.lock generated
View File

@@ -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",

View File

@@ -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"

View File

@@ -1,9 +1,9 @@
<?php return array(
'root' => 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(),

View File

@@ -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
<a href="https://ma.tt/"><img src="website/src/images/sponsor/matt.png" alt="Matt Mullenweg" width="290" height="64"></a>
<a href="https://mojam.co/"><img src="website/src/images/sponsor/mojam.png" alt="Mojam" width="290" height="64"></a>
<br><br>
### Silver Sponsors
<a href="https://www.startupjobs.cz/startup/shipmonk"><img src="website/src/images/sponsor/shipmonk.jpg" alt="ShipMonk" width="290" height="64"></a>
<a href="https://www.shopware.com/en/"><img src="website/src/images/sponsor/shopware.png" alt="Shopware" width="284" height="64"></a>
<br><br>
### Bronze Sponsors
<a href="https://coders.thecodingmachine.com/phpstan"><img src="website/src/images/sponsor/tcm.png" alt="TheCodingMachine" width="247" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://packagist.com/?utm_source=phpstan&utm_medium=readme&utm_campaign=sponsorlogo"><img src="website/src/images/sponsor/packagist.png" alt="Private Packagist" width="283" height="64"></a>
<br>
<a href="https://www.cdn77.com/"><img src="website/src/images/sponsor/cdn77.png" alt="CDN77" width="283" height="64"></a>
<a href="https://www.cdn77.com/"><img src="website/src/images/sponsor/cdn77.png" alt="CDN77" width="290" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://blackfire.io/docs/introduction?utm_source=phpstan&utm_medium=github_readme&utm_campaign=logo"><img src="website/src/images/sponsor/blackfire.png" alt="Blackfire.io" width="254" height="64"></a>
<br>
@@ -36,23 +54,23 @@ can be checked before you run the actual line.
&nbsp;&nbsp;&nbsp;
<a href="https://www.fame.fi/"><img src="website/src/images/sponsor/fame.png" alt="Fame Helsinki" width="283" height="64"></a>
<br>
<a href="https://www.startupjobs.cz/startup/shipmonk"><img src="website/src/images/sponsor/shipmonk.jpg" alt="ShipMonk" width="290" height="64"></a>
<a href="https://werkenbijbelsimpel.nl/en/about-us/"><img src="website/src/images/sponsor/belsimpel.png" alt="Belsimpel" width="284" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://togetter.com/"><img src="website/src/images/sponsor/togetter.png" alt="Togetter" width="283" height="64"></a>
<br>
<a href="https://join.rightcapital.com/?utm_source=phpstan&utm_medium=github&utm_campaign=sponsorship"><img src="website/src/images/sponsor/rightcapital.png" alt="RightCapital" width="283" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://www.contentkingapp.com/?ref=php-developer&utm_source=phpstan&utm_medium=referral&utm_campaign=sponsorship"><img src="website/src/images/sponsor/contentking.png" alt="ContentKing" width="283" height="64"></a>
<a href="https://www.shoptet.cz/"><img src="website/src/images/sponsor/shoptet.png" alt="Shoptet" width="283" height="64"></a>
<br>
<a href="https://zol.fr?utm_source=phpstan"><img src="website/src/images/sponsor/zol.png" alt="ZOL" width="283" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://www.edgenext.com/"><img src="website/src/images/sponsor/edgenext.png" alt="EdgeNext" width="283" height="64"></a>
<br>
<a href="https://www.shopware.com/en/"><img src="website/src/images/sponsor/shopware.png" alt="Shopware" width="284" height="64"></a>
<a href="https://route4me.com/"><img src="website/src/images/sponsor/route4me.png" alt="Route4Me: Route Optimizer and Route Planner Software" width="283" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://craftcms.com/"><img src="website/src/images/sponsor/craftcms.png" alt="Craft CMS" width="283" height="64"></a>
<br>
<a href="https://www.worksome.com/"><img src="website/src/images/sponsor/worksome.png" alt="Worksome" width="283" height="64"></a>
<a href="https://jobs.ticketswap.com/"><img src="website/src/images/sponsor/ticketswap.png" alt="TicketSwap" width="269" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://www.campoint.net/"><img src="website/src/images/sponsor/campoint.png" alt="campoint AG" width="283" height="64"></a>
<br>
@@ -60,18 +78,10 @@ can be checked before you run the actual line.
&nbsp;&nbsp;&nbsp;
<a href="https://inviqa.com/"><img src="website/src/images/sponsor/inviqa.png" alt="Inviqa" width="254" height="65"></a>
<br>
<a href="https://www.shoptet.cz/"><img src="website/src/images/sponsor/shoptet.png" alt="Shoptet" width="283" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://route4me.com/"><img src="website/src/images/sponsor/route4me.png" alt="Route4Me: Route Optimizer and Route Planner Software" width="283" height="64"></a>
<br>
<a href="https://werkenbijbelsimpel.nl/en/about-us/"><img src="website/src/images/sponsor/belsimpel.png" alt="Belsimpel" width="284" height="64"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://jobs.ticketswap.com/"><img src="website/src/images/sponsor/ticketswap.png" alt="TicketSwap" width="269" height="64"></a>
[**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.

View File

@@ -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);

View File

@@ -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",

Binary file not shown.

View File

@@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmgOIscACgkQUcZzBf/C
5cBGzA//Wya23VZ7JBZM3RNR4g4d3ez39/BIa5XBHAF1Hpm9dmliDlME6R73ZNHk
D7LT/tLU72AgYuWaIp0mADIkmqU+OPZTGKXkncJHxWlcJm5QLZxy6tYvC8MUvjHK
lv2Vs1Ito9rbnnTHTieAnjvp7Ne3YUmVMLTHPP+R8tyPcNeHbHpUqlQf83sb6OK7
7fZKBeHvb98p1ii9uNetzjC/CWbknHddq9viT46TZYuwXMVKYOuMkweppMHlxOY0
741+FQQ3dJB7Jp3NOLwYYqe7WcMyKrYiXJuIvpUSK38EbHg6NTDqwvenXTDMN45i
x8vhc5mhJHkuNfjqgjgpvvqFMt1WtoYa3a26ArwVcEKfptAkgGsNxvs4TS5xx9xC
fFzyOhMEPbHRSe7Dnct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