diff options
| author | 2022-01-04 13:59:09 +0100 | |
|---|---|---|
| committer | 2022-01-04 13:59:09 +0100 | |
| commit | 1335a0e3cf11a0d4248e9eaaf748b89e6df741ef (patch) | |
| tree | ed6a8d17cef0581e5b0402dc8dfedd42fabfe9c7 /lib | |
| parent | 0988b0c2be911133f883313bc3a858670192cc69 (diff) | |
PHPStan level 5 (#4110)
* Fix most PHPDocs errors
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types
* Avoid func_get_args
Use variadic syntax instead https://php.net/manual/functions.arguments#functions.variable-arg-list
And avoid dynamic functions names when possible to more easily identify calls and unused functions.
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
* PHPStan level 3
* PHPStand level 4
* Update default to PHPStan level 4
* Towards level 5
* Fix level 4 regression
* Towards level 5
* Pass PHPStan level 5
* Towards level 6
* Remove erronenous regression from changelog
https://github.com/FreshRSS/FreshRSS/pull/4116
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/Configuration.php | 10 | ||||
| -rw-r--r-- | lib/Minz/Dispatcher.php | 3 | ||||
| -rw-r--r-- | lib/Minz/Error.php | 4 | ||||
| -rw-r--r-- | lib/Minz/Extension.php | 2 | ||||
| -rw-r--r-- | lib/Minz/ExtensionManager.php | 8 | ||||
| -rw-r--r-- | lib/Minz/Log.php | 3 | ||||
| -rw-r--r-- | lib/Minz/Migrator.php | 2 | ||||
| -rw-r--r-- | lib/Minz/ModelPdo.php | 1 | ||||
| -rw-r--r-- | lib/Minz/Paginator.php | 2 | ||||
| -rw-r--r-- | lib/Minz/Request.php | 7 | ||||
| -rw-r--r-- | lib/Minz/Translate.php | 6 | ||||
| -rw-r--r-- | lib/Minz/Url.php | 13 | ||||
| -rw-r--r-- | lib/Minz/View.php | 2 | ||||
| -rw-r--r-- | lib/http-conditional.php | 2 | ||||
| -rw-r--r-- | lib/lib_install.php | 6 | ||||
| -rw-r--r-- | lib/lib_phpQuery.php | 18 | ||||
| -rw-r--r-- | lib/lib_rss.php | 73 |
17 files changed, 121 insertions, 41 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 539b1da62..403d6ccba 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -2,6 +2,14 @@ /** * Manage configuration for the application. + * @property-read string $base_url + * @property array<string|array<int,string>> $db + * @property-read string $disable_update + * @property-read string $environment + * @property-read array<string> $extensions_enabled + * @property-read string $mailer + * @property-read string $smtp + * @property string $title */ class Minz_Configuration { /** @@ -58,6 +66,8 @@ class Minz_Configuration { /** * The namespace of the current configuration. + * Unused. + * @phpstan-ignore-next-line */ private $namespace = ''; diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.php index f2664cbe0..3adcb2492 100644 --- a/lib/Minz/Dispatcher.php +++ b/lib/Minz/Dispatcher.php @@ -41,6 +41,7 @@ class Minz_Dispatcher { $this->createController (Minz_Request::controllerName ()); $this->controller->init (); $this->controller->firstAction (); + // @phpstan-ignore-next-line if (!self::$needsReset) { $this->launchAction ( Minz_Request::actionName () @@ -49,6 +50,7 @@ class Minz_Dispatcher { } $this->controller->lastAction (); + // @phpstan-ignore-next-line if (!self::$needsReset) { $this->controller->declareCspHeader(); $this->controller->view ()->build (); @@ -56,6 +58,7 @@ class Minz_Dispatcher { } catch (Minz_Exception $e) { throw $e; } + // @phpstan-ignore-next-line } while (self::$needsReset); } diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php index 32de05f0c..bef273bda 100644 --- a/lib/Minz/Error.php +++ b/lib/Minz/Error.php @@ -13,7 +13,7 @@ class Minz_Error { /** * Permet de lancer une erreur * @param int $code le type de l'erreur, par défaut 404 (page not found) - * @param array<string> $logs logs d'erreurs découpés de la forme + * @param array<string>|array<string,array<string>> $logs logs d'erreurs découpés de la forme * > $logs['error'] * > $logs['warning'] * > $logs['notice'] @@ -50,7 +50,7 @@ class Minz_Error { /** * Permet de retourner les logs de façon à n'avoir que * ceux que l'on veut réellement - * @param array<string> $logs les logs rangés par catégories (error, warning, notice) + * @param array<string,string>|string $logs les logs rangés par catégories (error, warning, notice) * @return array<string> liste des logs, sans catégorie, en fonction de l'environment */ private static function processLogs ($logs) { diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php index 82f9a0631..a35d7d8b6 100644 --- a/lib/Minz/Extension.php +++ b/lib/Minz/Extension.php @@ -192,7 +192,7 @@ abstract class Minz_Extension { * Register a new hook. * * @param string $hook_name the hook name (must exist). - * @param callable-string $hook_function the function name to call (must be callable). + * @param callable-string|array<string> $hook_function the function name to call (must be callable). */ public function registerHook($hook_name, $hook_function) { Minz_ExtensionManager::addHook($hook_name, $hook_function, $this); diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index 576064b35..2b42708f8 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -210,7 +210,7 @@ class Minz_ExtensionManager { * * The extension init() method will be called. * - * @param Minz_Extension $ext_name is the name of a valid extension present in $ext_list. + * @param string $ext_name is the name of a valid extension present in $ext_list. */ public static function enable($ext_name) { if (isset(self::$ext_list[$ext_name])) { @@ -295,8 +295,8 @@ class Minz_ExtensionManager { * array keys. * * @param string $hook_name the hook to call. - * @param array<mixed> $args additional parameters (for signature, please see self::$hook_list). - * @return mixed final result of the called hook. + * @param mixed $args additional parameters (for signature, please see self::$hook_list). + * @return mixed|null final result of the called hook. */ public static function callHook($hook_name, ...$args) { if (!isset(self::$hook_list[$hook_name])) { @@ -328,7 +328,7 @@ class Minz_ExtensionManager { * * @param string $hook_name is the hook to call. * @param mixed $arg is the argument to pass to the first extension hook. - * @return mixed final chained result of the hooks. If nothing is changed, + * @return mixed|null final chained result of the hooks. If nothing is changed, * the initial argument is returned. */ private static function callOneToOne($hook_name, $arg) { diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index 2b11f9b8b..e0e22e532 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -61,6 +61,7 @@ class Minz_Log { $log = '[' . date('r') . '] [' . $level_label . '] --- ' . $information . "\n"; + // @phpstan-ignore-next-line if (defined('COPY_LOG_TO_SYSLOG') && COPY_LOG_TO_SYSLOG) { syslog($level, '[' . $username . '] ' . trim($log)); } @@ -84,6 +85,7 @@ class Minz_Log { */ protected static function ensureMaxLogSize($file_name) { $maxSize = defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 1048576; + // @phpstan-ignore-next-line if ($maxSize > 0 && @filesize($file_name) > $maxSize) { $fp = fopen($file_name, 'c+'); if ($fp && flock($fp, LOCK_EX)) { @@ -98,6 +100,7 @@ class Minz_Log { } else { throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR); } + // @phpstan-ignore-next-line if ($fp) { fclose($fp); } diff --git a/lib/Minz/Migrator.php b/lib/Minz/Migrator.php index d69a65422..637bfc3fa 100644 --- a/lib/Minz/Migrator.php +++ b/lib/Minz/Migrator.php @@ -160,7 +160,7 @@ class Minz_Migrator * * @param string $version The version of the migration (be careful, migrations * are sorted with the `strnatcmp` function) - * @param callback $callback The migration function to execute, it should + * @param callable $callback The migration function to execute, it should * return true on success and must return false * on error * diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index c03b28575..f183dae10 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -15,7 +15,6 @@ class Minz_ModelPdo { */ public static $usesSharedPdo = true; private static $sharedPdo = null; - private static $sharedPrefix; private static $sharedCurrentUser; protected $pdo; diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php index 7504bf4ce..f7bb0cc4f 100644 --- a/lib/Minz/Paginator.php +++ b/lib/Minz/Paginator.php @@ -184,7 +184,7 @@ class Minz_Paginator { } private function _nbPage () { if ($this->nbItemsPerPage > 0) { - $this->nbPage = ceil ($this->nbItems () / $this->nbItemsPerPage); + $this->nbPage = (int)ceil($this->nbItems() / $this->nbItemsPerPage); } } public function _nbItems ($value) { diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index 7625cf5ed..e74f4f908 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -43,6 +43,7 @@ class Minz_Request { if (isset(self::$params[$key])) { $p = self::$params[$key]; $tp = trim($p); + // @phpstan-ignore-next-line if ($p === null || $tp === '' || $tp === 'null') { return null; } elseif ($p == false || $tp == '0' || $tp === 'false' || $tp === 'no') { @@ -328,7 +329,7 @@ class Minz_Request { /** * Relance une requête - * @param array<string,string> $url l'url vers laquelle est relancée la requête + * @param array<string,string|array<string,string>> $url l'url vers laquelle est relancée la requête * @param bool $redirect si vrai, force la redirection http * > sinon, le dispatcher recharge en interne */ @@ -359,7 +360,7 @@ class Minz_Request { /** * Wrappers good notifications + redirection * @param string $msg notification content - * @param array<string,string> $url url array to where we should be forwarded + * @param array<string,string|array<string,string>> $url url array to where we should be forwarded */ public static function good($msg, $url = array()) { Minz_Request::setGoodNotification($msg); @@ -369,7 +370,7 @@ class Minz_Request { /** * Wrappers bad notifications + redirection * @param string $msg notification content - * @param array<string,string> $url url array to where we should be forwarded + * @param array<string,string|array<string,mixed>> $url url array to where we should be forwarded */ public static function bad($msg, $url = array()) { Minz_Request::setBadNotification($msg); diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index 0659b0de2..4b860259e 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -85,7 +85,7 @@ class Minz_Translate { * Return the language to use in the application. * It returns the connected language if it exists then returns the first match from the * preferred languages then returns the default language - * @param string $user the connected user language (nullable) + * @param string|null $user the connected user language (nullable) * @param array<string> $preferred an array of the preferred languages * @param string $default the preferred language to use * @return string containing the language to use @@ -179,7 +179,7 @@ class Minz_Translate { /** * Translate a key into its corresponding value based on selected language. * @param string $key the key to translate. - * @param string $args additional parameters for variable keys. + * @param mixed $args additional parameters for variable keys. * @return string value corresponding to the key. * If no value is found, return the key itself. */ @@ -247,7 +247,7 @@ class Minz_Translate { /** * Alias for Minz_Translate::t() * @param string $key - * @param array<string> $args + * @param mixed $args */ function _t($key, ...$args) { return Minz_Translate::t($key, ...$args); diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php index 59afff557..777962e25 100644 --- a/lib/Minz/Url.php +++ b/lib/Minz/Url.php @@ -6,13 +6,13 @@ class Minz_Url { /** * Affiche une Url formatée - * @param array<string,string> $url l'url à formater définie comme un tableau : + * @param string|array<string,string|array<string,mixed>> $url l'url à formater définie comme un tableau : * $url['c'] = controller * $url['a'] = action * $url['params'] = tableau des paramètres supplémentaires * ou comme une chaîne de caractère * @param string $encodage pour indiquer comment encoder les & (& ou & pour html) - * @param bool $absolute + * @param bool|string $absolute * @return string url formatée */ public static function display ($url = array (), $encodage = 'html', $absolute = false) { @@ -96,8 +96,8 @@ class Minz_Url { /** * Vérifie que les éléments du tableau représentant une url soit ok - * @param array<string,string>|string $url sous forme de tableau (sinon renverra directement $url) - * @return string url vérifié + * @param array<string,array<string,string>> $url sous forme de tableau + * @return array<string,array<string,string>> url vérifié */ public static function checkUrl ($url) { $url_checked = $url; @@ -121,7 +121,7 @@ class Minz_Url { /** * @param string $controller * @param string $action - * @param array<string,string> $args + * @param string $args */ function _url ($controller, $action, ...$args) { $nb_args = count($args); @@ -132,7 +132,8 @@ function _url ($controller, $action, ...$args) { $params = array (); for ($i = 0; $i < $nb_args; $i += 2) { - $params[$args[$i]] = $args[$i + 1]; + $arg = $args[$i]; + $params[$arg] = $args[$i + 1]; } return Minz_Url::display (array ('c' => $controller, 'a' => $action, 'params' => $params)); diff --git a/lib/Minz/View.php b/lib/Minz/View.php index bc38b8783..6b90b3c31 100644 --- a/lib/Minz/View.php +++ b/lib/Minz/View.php @@ -146,7 +146,7 @@ class Minz_View { /** * Choose the current view layout. - * @param string $layout the layout name to use, false to use no layouts. + * @param string|false $layout the layout name to use, false to use no layouts. */ public function _layout($layout) { if ($layout) { diff --git a/lib/http-conditional.php b/lib/http-conditional.php index 6d3a0a97f..ad920455d 100644 --- a/lib/http-conditional.php +++ b/lib/http-conditional.php @@ -93,12 +93,14 @@ function httpConditional($UnixTimeStamp,$cacheSeconds=0,$cachePrivacy=0,$feedMod } $etagServer='"'.md5($scriptName.$myQuery.'#'.$dateLastModif).'"'; + // @phpstan-ignore-next-line if ((!$is412)&&isset($_SERVER['HTTP_IF_MATCH'])) {//rfc2616-sec14.html#sec14.24 $etagsClient=stripslashes($_SERVER['HTTP_IF_MATCH']); $etagsClient=str_ireplace('-gzip','',$etagsClient); $is412=(($etagsClient!=='*')&&(strpos($etagsClient,$etagServer)===false)); } + // @phpstan-ignore-next-line if ($is304&&isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {//rfc2616-sec14.html#sec14.25 //rfc1945.txt $nbCond++; diff --git a/lib/lib_install.php b/lib/lib_install.php index 82c98d646..886fff54c 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -41,9 +41,13 @@ function checkRequirements($dbType = '') { $xml = function_exists('xml_parser_create'); $json = function_exists('json_encode'); $mbstring = extension_loaded('mbstring'); + // @phpstan-ignore-next-line $data = DATA_PATH && is_writable(DATA_PATH); + // @phpstan-ignore-next-line $cache = CACHE_PATH && is_writable(CACHE_PATH); + // @phpstan-ignore-next-line $tmp = TMP_PATH && is_writable(TMP_PATH); + // @phpstan-ignore-next-line $users = USERS_PATH && is_writable(USERS_PATH); $favicons = is_writable(join_path(DATA_PATH, 'favicons')); @@ -73,7 +77,7 @@ function checkRequirements($dbType = '') { } function generateSalt() { - return sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); + return sha1(uniqid('' . mt_rand(), true).implode('', stat(__FILE__))); } function initDb() { diff --git a/lib/lib_phpQuery.php b/lib/lib_phpQuery.php index 797c1676a..29d06749c 100644 --- a/lib/lib_phpQuery.php +++ b/lib/lib_phpQuery.php @@ -4642,7 +4642,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocument($markup = null, $contentType = null) { @@ -4655,7 +4655,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentHTML($markup = null, $charset = null) { @@ -4668,7 +4668,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentXML($markup = null, $charset = null) { @@ -4681,7 +4681,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentXHTML($markup = null, $charset = null) { @@ -4694,7 +4694,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentPHP($markup = null, $contentType = "text/html") { @@ -4784,7 +4784,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentFileHTML($file, $charset = null) { @@ -4797,7 +4797,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentFileXML($file, $charset = null) { @@ -4810,7 +4810,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentFileXHTML($file, $charset = null) { @@ -4823,7 +4823,7 @@ abstract class phpQuery { * Creates new document from markup. * Chainable. * - * @param unknown_type $markup + * @param string $markup * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery */ public static function newDocumentFilePHP($file, $contentType = null) { diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 2627773b6..e347073a4 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -9,6 +9,7 @@ if (!function_exists('mb_strcut')) { } } +// @phpstan-ignore-next-line if (COPY_SYSLOG_TO_STDERR) { openlog('FreshRSS', LOG_CONS | LOG_ODELAY | LOG_PID | LOG_PERROR, LOG_USER); } else { @@ -18,7 +19,7 @@ if (COPY_SYSLOG_TO_STDERR) { /** * Build a directory path by concatenating a list of directory names. * - * @param array<string> $path_parts a list of directory names + * @param string $path_parts a list of directory names * @return string corresponding to the final pathname */ function join_path(...$path_parts) { @@ -52,6 +53,10 @@ function classAutoloader($class) { spl_autoload_register('classAutoloader'); //</Auto-loading> +/** + * @param string $url + * @return string + */ function idn_to_puny($url) { if (function_exists('idn_to_ascii')) { $idn = parse_url($url, PHP_URL_HOST); @@ -73,6 +78,11 @@ function idn_to_puny($url) { return $url; } +/** + * @param string $url + * @param bool $fixScheme + * @return string|false + */ function checkUrl($url, $fixScheme = true) { $url = trim($url); if ($url == '') { @@ -92,18 +102,39 @@ function checkUrl($url, $fixScheme = true) { } } +/** + * @param string $text + * @return string + */ function safe_ascii($text) { return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); } if (function_exists('mb_convert_encoding')) { + /** + * @param string $text + * @return string + */ function safe_utf8($text) { return mb_convert_encoding($text, 'UTF-8', 'UTF-8'); } } elseif (function_exists('iconv')) { + /** + * @param string $text + * @return string + */ function safe_utf8($text) { return iconv('UTF-8', 'UTF-8//IGNORE', $text); } } else { + /** + * @param string $text + * @return string + */ function safe_utf8($text) { return $text; } } +/** + * @param string $text + * @param bool $extended + * @return string + */ function escapeToUnicodeAlternative($text, $extended = true) { $text = htmlspecialchars_decode($text, ENT_QUOTES); @@ -156,6 +187,10 @@ function timestamptodate ($t, $hour = true) { return @date ($date, $t); } +/** + * @param string $text + * @return string + */ function html_only_entity_decode($text) { static $htmlEntitiesOnly = null; if ($htmlEntitiesOnly === null) { @@ -167,6 +202,10 @@ function html_only_entity_decode($text) { return $text == '' ? '' : strtr($text, $htmlEntitiesOnly); } +/** + * @param array<string,mixed> $attributes + * @return SimplePie + */ function customSimplePie($attributes = array()) { $limits = FreshRSS_Context::$system_conf->limits; $simplePie = new SimplePie(); @@ -276,7 +315,7 @@ function sanitizeHTML($data, $base = '', $maxLength = false) { */ function validateEmailAddress($email) { $mailer = new PHPMailer\PHPMailer\PHPMailer(); - $mailer->Charset = 'utf-8'; + $mailer->CharSet = 'utf-8'; $punyemail = $mailer->punyencodeAddress($email); return PHPMailer\PHPMailer\PHPMailer::validateAddress($punyemail, 'html5'); } @@ -294,9 +333,12 @@ function lazyimg($content) { ); } +/** + * @return string + */ function uTimeString() { $t = @gettimeofday(); - return $t['sec'] . str_pad($t['usec'], 6, '0', STR_PAD_LEFT); + return $t['sec'] . str_pad('' . $t['usec'], 6, '0', STR_PAD_LEFT); } function invalidateHttpCache($username = '') { @@ -311,6 +353,9 @@ function invalidateHttpCache($username = '') { return $ok; } +/** + * @return array<string> + */ function listUsers() { $final_list = array(); $base_path = join_path(DATA_PATH, 'users'); @@ -349,7 +394,7 @@ function max_registrations_reached() { * objects. If you need a long-time configuration, please don't use this function. * * @param string $username the name of the user of which we want the configuration. - * @return Minz_Configuration|null object, or null if the configuration cannot be loaded. + * @return FreshRSS_UserConfiguration|null object, or null if the configuration cannot be loaded. */ function get_user_configuration($username) { if (!FreshRSS_user_Controller::checkUsername($username)) { @@ -368,10 +413,16 @@ function get_user_configuration($username) { return null; } - return Minz_Configuration::get($namespace); + /** + * @var FreshRSS_UserConfiguration $user_conf + */ + $user_conf = Minz_Configuration::get($namespace); + return $user_conf; } - +/** + * @return string + */ function httpAuthUser() { if (!empty($_SERVER['REMOTE_USER'])) { return $_SERVER['REMOTE_USER']; @@ -383,6 +434,9 @@ function httpAuthUser() { return ''; } +/** + * @return bool + */ function cryptAvailable() { try { $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; @@ -425,8 +479,11 @@ function check_install_php() { */ function check_install_files() { return array( + // @phpstan-ignore-next-line 'data' => DATA_PATH && is_writable(DATA_PATH), + // @phpstan-ignore-next-line 'cache' => CACHE_PATH && is_writable(CACHE_PATH), + // @phpstan-ignore-next-line 'users' => USERS_PATH && is_writable(USERS_PATH), 'favicons' => is_writable(DATA_PATH . '/favicons'), 'tokens' => is_writable(DATA_PATH . '/tokens'), @@ -497,8 +554,8 @@ function recursive_unlink($dir) { /** * Remove queries where $get is appearing. * @param string $get the get attribute which should be removed. - * @param array<string,string> $queries an array of queries. - * @return array<string,string> whithout queries where $get is appearing. + * @param array<int,array<string,string>> $queries an array of queries. + * @return array<int,array<string,string>> whithout queries where $get is appearing. */ function remove_query_by_get($get, $queries) { $final_queries = array(); |
