diff options
author | Andrew Dolgov <[email protected]> | 2021-11-14 21:30:24 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-11-14 21:30:24 +0300 |
commit | b74908bab9dfbc1fcebb476307140d2bdbc02c2c (patch) | |
tree | 7cec8e851abb57666668553e5645846fc4f140aa | |
parent | af6a299fe7abaf73483d604df8a5df073a5e546f (diff) |
fix phpstan warnings
-rw-r--r-- | init.php | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,10 +1,10 @@ <?php class Af_Proxy_Http extends Plugin { - /* @var PluginHost $host */ + /** @var PluginHost $host */ private $host; - /* @var DiskCache $cache */ + /** @var DiskCache $cache */ private $cache; function about() { @@ -13,6 +13,7 @@ class Af_Proxy_Http extends Plugin { "fox"); } + /** @var string */ private $ssl_known_whitelist = "imgur.com gfycat.com i.reddituploads.com pbs.twimg.com i.redd.it i.sli.mg media.tumblr.com"; function is_public_method($method) { @@ -33,7 +34,7 @@ class Af_Proxy_Http extends Plugin { $_SESSION['af_proxy_http_token'] = bin2hex(get_random_bytes(16)); } - function hook_enclosure_entry($enc) { + function hook_enclosure_entry($enc, $id, $rv) { if (preg_match("/image/", $enc["content_type"])) { $proxy_all = $this->host->get($this, "proxy_all"); @@ -47,7 +48,7 @@ class Af_Proxy_Http extends Plugin { return $this->hook_render_article_cdm($article); } - public function imgproxy() { + public function imgproxy() : void { $url = UrlHelper::validate(clean($_REQUEST["url"])); // immediately redirect to original URL if: @@ -105,7 +106,7 @@ class Af_Proxy_Http extends Plugin { } } - private function rewrite_url_if_needed($url, $all_remote = false) { + private function rewrite_url_if_needed(string $url, bool $all_remote = false) : string { /* don't rewrite urls pointing to ourselves */ if (strpos($url, get_self_url_prefix()) === 0) @@ -150,7 +151,7 @@ class Af_Proxy_Http extends Plugin { return $url; } - function hook_render_article_cdm($article, $api_mode = false) { + function hook_render_article_cdm($article) { $need_saving = false; $proxy_all = $this->host->get($this, "proxy_all"); @@ -238,7 +239,7 @@ class Af_Proxy_Http extends Plugin { <?php } - function save() { + function save() : void { $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"] ?? ""); $this->host->set($this, "proxy_all", $proxy_all); |