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)
{
$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_file = "$tmp_dir/$file_name";
return $tmp_file;
@ -405,10 +403,9 @@ function _execute_proc_cmd($cmd, &$ret, &$out)
$proc = popen("$cmd 2>&1", 'r');
$log = '';
//TODO: how can this be?
if(is_string($proc))
if(!is_resource($proc))
{
$log = $proc;
$log = "";
_log($log, 1);
}
else
@ -978,7 +975,7 @@ function run_background_gamectl_workers($task, array $worker_args)
{
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($out_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)
{
if(count($warnings_list) > 0)
if(count($warnings_list) > 0) // @phpstan-ignore-line
$msg .= "\n\nPossible causes:\n" . implode("\n", $warnings_list) . "\n";
throw new Exception($msg);
};