Making PHPStan happy

This commit is contained in:
Pavel Shevaev 2023-08-16 14:09:46 +03:00
parent 6d01fc3e66
commit a73cc632d4
1 changed files with 4 additions and 7 deletions

View File

@ -41,8 +41,6 @@ function fatal($msg)
function make_tmp_file_name($file_name) function make_tmp_file_name($file_name)
{ {
$meta = stream_get_meta_data(tmpfile()); $meta = stream_get_meta_data(tmpfile());
if(!isset($meta['uri']))
throw new Exception("Could not get temp directory name");
$tmp_dir = dirname($meta['uri']); $tmp_dir = dirname($meta['uri']);
$tmp_file = "$tmp_dir/$file_name"; $tmp_file = "$tmp_dir/$file_name";
return $tmp_file; return $tmp_file;
@ -405,10 +403,9 @@ function _execute_proc_cmd($cmd, &$ret, &$out)
$proc = popen("$cmd 2>&1", 'r'); $proc = popen("$cmd 2>&1", 'r');
$log = ''; $log = '';
//TODO: how can this be? if(!is_resource($proc))
if(is_string($proc))
{ {
$log = $proc; $log = "";
_log($log, 1); _log($log, 1);
} }
else else
@ -978,7 +975,7 @@ function run_background_gamectl_workers($task, array $worker_args)
{ {
foreach($workers as $item) foreach($workers as $item)
{ {
list($in_file, $log_file, $err_file) = $item; list($in_file, $out_file, $log_file, $err_file) = $item;
@ensure_rm($in_file); @ensure_rm($in_file);
@ensure_rm($out_file); @ensure_rm($out_file);
@ensure_rm($log_file); @ensure_rm($log_file);
@ -1028,7 +1025,7 @@ function watch_running_process($pid, $log_file, $exit_matches = array(), $error_
$throw_fn = function($msg) use (&$warnings_list) $throw_fn = function($msg) use (&$warnings_list)
{ {
if(count($warnings_list) > 0) if(count($warnings_list) > 0) // @phpstan-ignore-line
$msg .= "\n\nPossible causes:\n" . implode("\n", $warnings_list) . "\n"; $msg .= "\n\nPossible causes:\n" . implode("\n", $warnings_list) . "\n";
throw new Exception($msg); throw new Exception($msg);
}; };