下面的错误是每分钟记录到 Laravel 存储日志中的堆栈跟踪。
[2020-09-25 19:51:40] local.ERROR: Uncaught Error: Class 'Arr' not found in Command line code:1
Stack trace:
#0 {main}
thrown {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught Error: Class 'Arr' not found in Command line code:1
Stack trace:
#0 {main}
thrown at Command line code:1)
[stacktrace]
#0 {main}
"}
Run Code Online (Sandbox Code Playgroud)
我没有在我的控制器或刀片模板中的任何地方使用过它。
任何帮助表示赞赏。
Ash*_*din 12
对于收到此问题的任何人,这实际上是一个名为laravel-extra-intellisense的 VSCode Laravel 插件的问题。
该问题实际上来自插件的问题,因为它使用 Laravel 5.8 及更高版本的功能,因此如果您的项目使用 Laravel 5.7 及更低版本,您可以执行此操作来清除错误。
将此行添加到您的 config/app.php
'Arr' => Illuminate\Support\Arr::class, dlam config/app.php
Run Code Online (Sandbox Code Playgroud)
添加该行后,您可能会收到这样的新错误
[2020-10-06 05:57:04] local.ERROR: Uncaught ReflectionException: Class App\Policies\ModelPolicy does not exist in Command line code:1
Stack trace:
#0 Command line code(1): ReflectionClass->__construct('App\\Policies\\Mo...')
#1 [internal function]: {closure}('App\\Policies\\Mo...', 'App\\Model')
#2 Command line code(1): array_map(Object(Closure), Array, Array)
#3 {main}
thrown {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught ReflectionException: Class App\\Policies\\ModelPolicy does not exist in Command line code:1
Stack trace:
#0 Command line code(1): ReflectionClass->__construct('App\\\\Policies\\\\Mo...')
#1 [internal function]: {closure}('App\\\\Policies\\\\Mo...', 'App\\\\Model')
#2 Command line code(1): array_map(Object(Closure), Array, Array)
#3 {main}
thrown at Command line code:1)
[stacktrace]
#0 {main}
"}
Run Code Online (Sandbox Code Playgroud)
您可以通过注释这一行来解决这个问题 app\Providers\AuthServiceProvider.php
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy', <-- comment this line
];
Run Code Online (Sandbox Code Playgroud)
所有这些变化都已经在最新的 Laravel(5.8 及以上版本)中
我认为发生这种情况是因为插件的记录器处理程序不起作用,这就是它登录您的 Laravel 项目的原因。因此,在修复之前,请执行上述操作或升级您的 Laravel。
您可以在插件的 github 中检查此问题
| 归档时间: |
|
| 查看次数: |
2086 次 |
| 最近记录: |