strict to phpstan-level-4

This commit is contained in:
crazywhalecc
2022-04-03 01:47:38 +08:00
parent 0bab2e74b0
commit 3451434997
19 changed files with 67 additions and 59 deletions

View File

@@ -19,17 +19,16 @@ class StaticFileHandler
if (strpos($full_path, $path) !== 0) {
$response->status(403);
$response->end('403 Forbidden');
return true;
return;
}
if (is_file($full_path)) {
$exp = strtolower(pathinfo($full_path)['extension'] ?? 'unknown');
$response->setHeader('Content-Type', ZMConfig::get('file_header')[$exp] ?? 'application/octet-stream');
$response->end(file_get_contents($full_path));
return true;
return;
}
}
$response->status(404);
$response->end(HttpUtil::getHttpCodePage(404));
return true;
}
}