diff options
| author | 2023-05-04 19:47:54 +0200 | |
|---|---|---|
| committer | 2023-05-04 19:47:54 +0200 | |
| commit | 30c69ef147059f440d304e7da5e0236d95e424fd (patch) | |
| tree | 3aeec77db07a4fe23a3721e85dbe5175f98bc2b9 /lib | |
| parent | 675c56f5799ed92a6aa3a8ad3d3d8d6636f444ec (diff) | |
Use PHPStan dynamicConstantNames (#5370)
https://phpstan.org/config-reference#constants
Avoid a few phpstan-ignore-next-line
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/Log.php | 7 | ||||
| -rw-r--r-- | lib/lib_install.php | 10 | ||||
| -rw-r--r-- | lib/lib_rss.php | 2 |
3 files changed, 6 insertions, 13 deletions
diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index 20e8578be..f30aac7d1 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -56,7 +56,6 @@ 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)); } @@ -80,7 +79,6 @@ class Minz_Log { */ protected static function ensureMaxLogSize(string $file_name): void { $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)) { @@ -95,10 +93,7 @@ class Minz_Log { } else { throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR); } - // @phpstan-ignore-next-line - if ($fp) { - fclose($fp); - } + fclose($fp); } } diff --git a/lib/lib_install.php b/lib/lib_install.php index 23c902440..780115b63 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -41,14 +41,14 @@ function checkRequirements(string $dbType = ''): array { $json = function_exists('json_encode'); $mbstring = extension_loaded('mbstring'); // @phpstan-ignore-next-line - $data = DATA_PATH && touch(DATA_PATH . '/index.html'); // is_writable() is not reliable for a folder on NFS + $data = DATA_PATH != '' && touch(DATA_PATH . '/index.html'); // is_writable() is not reliable for a folder on NFS // @phpstan-ignore-next-line - $cache = CACHE_PATH && touch(CACHE_PATH . '/index.html'); + $cache = CACHE_PATH != '' && touch(CACHE_PATH . '/index.html'); + $tmp = TMP_PATH != '' && is_writable(TMP_PATH); // @phpstan-ignore-next-line - $tmp = TMP_PATH && is_writable(TMP_PATH); + $users = USERS_PATH != '' && touch(USERS_PATH . '/index.html'); // @phpstan-ignore-next-line - $users = USERS_PATH && touch(USERS_PATH . '/index.html'); - $favicons = touch(DATA_PATH . '/favicons/index.html'); + $favicons = DATA_PATH != '' && touch(DATA_PATH . '/favicons/index.html'); return array( 'php' => $php ? 'ok' : 'ko', diff --git a/lib/lib_rss.php b/lib/lib_rss.php index a7e03d4ea..e7cb7386a 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -17,7 +17,6 @@ if (!function_exists('str_starts_with')) { } if (!function_exists('syslog')) { - // @phpstan-ignore-next-line if (COPY_SYSLOG_TO_STDERR && !defined('STDERR')) { define('STDERR', fopen('php://stderr', 'w')); } @@ -31,7 +30,6 @@ if (!function_exists('syslog')) { } if (function_exists('openlog')) { - // @phpstan-ignore-next-line if (COPY_SYSLOG_TO_STDERR) { openlog('FreshRSS', LOG_CONS | LOG_ODELAY | LOG_PID | LOG_PERROR, LOG_USER); } else { |
