diff options
| author | 2025-01-31 13:59:51 +0100 | |
|---|---|---|
| committer | 2025-01-31 13:59:51 +0100 | |
| commit | e749490693eccd61e9ea9152fada33470e5492f7 (patch) | |
| tree | 405c8c03a676f74399f21830e5e0244dac5eb8bd | |
| parent | f72f5e95238a866c39535932c803720d7644a276 (diff) | |
Pass PHPStan checkBenevolentUnionTypes (#7270)
| -rw-r--r-- | app/Models/Feed.php | 8 | ||||
| -rw-r--r-- | cli/CliOptionsParser.php | 1 | ||||
| -rw-r--r-- | phpstan-next.neon | 3 | ||||
| -rw-r--r-- | phpstan.dist.neon | 4 |
4 files changed, 11 insertions, 5 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 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.php index 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.neon index df4811a7a..d8fefc422 100644 --- a/phpstan-next.neon +++ b/phpstan-next.neon @@ -4,7 +4,6 @@ includes: parameters: level: max - checkBenevolentUnionTypes: true # TODO pass checkImplicitMixed: true # TODO pass strictRules: 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.php diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 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: true checkImplicitMixed: false # TODO pass checkMissingOverrideMethodAttribute: true checkTooWideReturnTypesInProtectedAndPublicMethods: true |
