在我今天得到的PHP的最新更新之后,Intelephense一直显示我的路由(以及其他类)的一个未定义符号的错误,以前没有这样的错误,它正在困扰我。
下面是错误截图:

这是我的密码:
Route::group(['prefix' => 'user', 'namespace' => 'Membership', 'name' => 'user.'], function () {
Route::get('profile', 'ProfileController@show')->name('profile.show');
Route::patch('profile', 'ProfileController@update')->name('profile.update');
Route::patch('change-password', 'ChangePasswordController@change')->name('change-password');
Route::get('role', 'ProfileController@getRole')->name('profile.role');
Route::get('summary', 'SummaryController@show')->name('summary');
Route::get('reserved', 'AuctionController@reservedAuction')->name('reserved');
});实际上,这段代码中没有错误,但是intelephense一直显示一个错误,那么有什么方法可以修复这个错误呢?
发布于 2019-12-10 12:12:54
Intelphense1.3添加了未定义的类型、函数、常量、类常量、方法和属性诊断,其中以前在1.2中只有未定义的变量诊断。
有些框架的编写方式为用户提供了方便的快捷方式,但使静态分析引擎很难发现运行时可用的符号。
存根生成器(如https://github.com/barryvdh/laravel-ide-helper )帮助填补了这里的空白,与Laravel一起使用它将通过提供易于发现的符号的具体定义来处理许多错误诊断。
尽管如此,PHP是一种非常灵活的语言,根据代码的编写方式,可能还会出现错误的未定义符号的其他实例。因此,从1.3.3开始,intelephense就有配置选项来启用/禁用每一类未定义的符号,以适应工作区和编码风格。
这些选项是:intelephense.diagnostics.undefinedTypes intelephense.diagnostics.undefinedFunctions intelephense.diagnostics.undefinedConstants intelephense.diagnostics.undefinedClassConstants intelephense.diagnostics.undefinedMethods intelephense.diagnostics.undefinedProperties intelephense.diagnostics.undefinedVariables
除intelephense.diagnostics.undefinedVariables之外,将所有这些设置为false将提供1.2版本的行为。请参阅VSCode设置UI并搜索intelephense。
发布于 2019-12-03 08:00:11
版本1.3.0有缺陷。
降级到1.2.3版本解决了我的问题。
我上了

发布于 2019-12-05 03:22:04
use Illuminate\Support\Facades\Route;在导入相应的命名空间后,警告就消失了。
版本的
https://stackoverflow.com/questions/59149877
复制相似问题