A free, self-hostable news aggregator…
Pass PHPStan checkBenevolentUnionTypes (#7270)
Alexandre Alapetitee749490693ec
diff --git a/app/Models/Feed.php b/app/Models/Feed.phpindex dd508299d..953ffc918 100644--- a/app/Models/Feed.php+++ b/app/Models/Feed.php@@ -1149,6 +1149,10 @@ class FreshRSS_Feed extends Minz_Model {file_put_contents($hubFilename, json_encode($hubJson));}$ch = curl_init();+ if ($ch === false) {+ Minz_Log::warning('curl_init() failed in ' . __METHOD__);+ return false;+ }curl_setopt_array($ch, [CURLOPT_URL => $hubJson['hub'],CURLOPT_RETURNTRANSFER => true,@@ -1166,6 +1170,10 @@ class FreshRSS_Feed extends Minz_Model {]);$response = curl_exec($ch);$info = curl_getinfo($ch);+ if (!is_array($info)) {+ Minz_Log::warning('curl_getinfo() failed in ' . __METHOD__);+ return false;+ }Minz_Log::warning('WebSub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $url .' via hub ' . $hubJson['hub'] .diff --git a/cli/CliOptionsParser.php b/cli/CliOptionsParser.phpindex 933575393..03fb68deb 100644--- a/cli/CliOptionsParser.php+++ b/cli/CliOptionsParser.php@@ -24,6 +24,7 @@ abstract class CliOptionsParser {private function parseInput(): void {$getoptInputs = $this->getGetoptInputs();+ // @phpstan-ignore argument.type$this->getoptOutputTransformer(getopt($getoptInputs['short'], $getoptInputs['long']));$this->checkForDeprecatedAliasUse();}diff --git a/phpstan-next.neon b/phpstan-next.neonindex df4811a7a..d8fefc422 100644--- a/phpstan-next.neon+++ b/phpstan-next.neon@@ -4,7 +4,6 @@ includes:parameters:level: max- checkBenevolentUnionTypes: true # TODO passcheckImplicitMixed: true # TODO passstrictRules:strictArrayFilter: false # TODO pass maybe@@ -13,10 +12,8 @@ parameters:# TODO: Update files below and remove them from this list- app/Models/Entry.php- app/Models/EntryDAO.php- - app/Models/Feed.php- app/Models/FeedDAO.php- app/Models/TagDAO.php- app/Models/Themes.php- app/Services/ImportService.php- app/views/helpers/feed/update.phtml- - cli/CliOptionsParser.phpdiff --git a/phpstan.dist.neon b/phpstan.dist.neonindex 0f7612d8a..202591c83 100644--- a/phpstan.dist.neon+++ b/phpstan.dist.neon@@ -14,13 +14,13 @@ parameters:- lib/phpgt/*- lib/phpmailer/*- lib/simplepie/*- - vendor/*analyseAndScan:- .git/*?- extensions/node_modules?- extensions/symbolic?- extensions/vendor?- node_modules/*?+ - vendor/*bootstrapFiles:- cli/_cli.php- lib/favicons.php@@ -36,7 +36,7 @@ parameters:- STDOUT- TMP_PATH- USERS_PATH- checkBenevolentUnionTypes: false # TODO pass+ checkBenevolentUnionTypes: truecheckImplicitMixed: false # TODO passcheckMissingOverrideMethodAttribute: truecheckTooWideReturnTypesInProtectedAndPublicMethods: true