From 288ed04ccc30b58373576dc3be811aee43e67034 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 31 Mar 2023 08:23:39 +0200 Subject: PHPStan level 6 for all PDO and Exception classes (#5239) * PHPStan level 6 for all PDO and Exception classes Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112 * Fix type * Now also our remaining own librairies * Motivation for a few more files * A few more DAO classes * Last interface --- lib/favicons.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/favicons.php') diff --git a/lib/favicons.php b/lib/favicons.php index fd03f61c8..abaa5e63a 100644 --- a/lib/favicons.php +++ b/lib/favicons.php @@ -2,7 +2,7 @@ const FAVICONS_DIR = DATA_PATH . '/favicons/'; const DEFAULT_FAVICON = PUBLIC_PATH . '/themes/icons/default_favicon.ico'; -function isImgMime($content) { +function isImgMime(string $content): bool { //Based on https://github.com/ArthurHoaro/favicon/blob/3a4f93da9bb24915b21771eb7873a21bde26f5d1/src/Favicon/Favicon.php#L311-L319 if ($content == '') { return false; @@ -21,7 +21,8 @@ function isImgMime($content) { return $isImage; } -function downloadHttp(&$url, $curlOptions = array()) { +/** @param array $curlOptions */ +function downloadHttp(string &$url, array $curlOptions = []): string { syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url); $url = checkUrl($url); if (!$url) { @@ -49,7 +50,7 @@ function downloadHttp(&$url, $curlOptions = array()) { return $info['http_code'] == 200 ? $response : ''; } -function searchFavicon(&$url) { +function searchFavicon(string &$url): string { $dom = new DOMDocument(); $html = downloadHttp($url); if ($html != '' && @$dom->loadHTML($html, LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING)) { @@ -84,7 +85,7 @@ function searchFavicon(&$url) { return ''; } -function download_favicon($url, $dest) { +function download_favicon(string $url, string $dest): bool { $url = trim($url); $favicon = searchFavicon($url); if ($favicon == '') { -- cgit v1.2.3