Laravel Intellisense/使用PhpStorm自动完成

Laravel Intellisense/使用PhpStorm自动完成

问题描述:

试图获得一个干净的环境以在Laravel 5.4/PhpStorm上工作. 遵循以下所有说明: https://github.com/barryvdh/laravel-ide-helper (包括安装PhpStorm Laravel插件)

Trying to get a clean environment to work on Laravel 5.4 / PhpStorm. Followed all the instructions from: https://github.com/barryvdh/laravel-ide-helper (including installing the PhpStorm Laravel plugin)

已获得生成的文件_ide_helper.php,已添加

Got the file_ide_helper.php generated, added

Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,

移至正确位置,清除缓存,重新启动...

to its proper location, cleared cache, restarted...

请查看所附图片,我应该由ide helper来解决缺乏智能的感觉吗?

Please look at attached image, is the lack of intellisense I get supposed to be fixed by the ide helper ?

好的,如果您已经安装了帮助程序,则可以使用以下解决方案:

Ok here is the solution, assuming you have installed the helper already:

示例:

替换控制器:

use Illuminate\Support\Facades\Validator;

通过

  use Validator

在您的config/app.php中,您必须具有以下别名:

In your config/app.php you must have this alias:

'Validator' => Illuminate\Support\Facades\Validator::class,

就我而言,它已经在那里.

In my case it was already there.

此后,如上图所示,该示例不再显示错误消息,并且我可以使用phpstorm的全部功能来正确理解:: make方法.

After this, no more error message for the example shown in the image above and I can use full power of phpstorm that correctly understands the ::make method.

来源 https://github.com/barryvdh/laravel-ide-helper/issues/431#issuecomment-275898789 谢谢@lazyone.

Source https://github.com/barryvdh/laravel-ide-helper/issues/431#issuecomment-275898789 thanks @lazyone.