fix(think-library): trace_file 参数类型改为 Throwable 以兼容 PHP Error

- 将 trace_file() 参数类型由 Exception 改为 \Throwable
- 解决 Library::load() 等处捕获 Error 时传入 trace_file 触发的 TypeError
- PHP 7+ 中 Error 与 Exception 均实现 Throwable,可统一记录到 trace 文件

Made-with: Cursor
This commit is contained in:
Anyon 2026-02-27 09:20:22 +08:00
parent d5e9524a89
commit c6c3184f73

View File

@ -415,8 +415,9 @@ if (!function_exists('down_file')) {
if (!function_exists('trace_file')) {
/**
* 输出异常数据到文件.
* @param \Throwable $exception 支持 Exception ErrorPHP 7+
*/
function trace_file(Exception $exception): bool
function trace_file(\Throwable $exception): bool
{
$path = Library::$sapp->getRuntimePath() . 'trace';
if (!is_dir($path)) {