Laravel和PhpStorm自动代码提示

Laravel和PhpStorm自动代码提示,laravel,phpstorm,Laravel,Phpstorm,我有一个返回集合的类: public function getCustomers() : Collection; 当我循环结果时,PhpStorm IDE将不知道集合中有什么 在.NET/JAVA中,您可以编写: public <List<Customer>> getCustomers(); 然后IDE将知道集合中的内容,并知道如何完成/提示 有什么技巧可以将其引入PhpStorm吗?使用docblocks很容易: /** * @return Customer[]|

我有一个返回集合的类:

public function getCustomers() : Collection;
当我循环结果时,PhpStorm IDE将不知道集合中有什么

在.NET/JAVA中,您可以编写:

public <List<Customer>> getCustomers();
然后IDE将知道集合中的内容,并知道如何完成/提示


有什么技巧可以将其引入PhpStorm吗?

使用docblocks很容易:

/**
 * @return Customer[]|Collection
 */
public function getCustomers();
实际上,您在这里所做的是告诉phpStorm函数返回一个客户对象数组以及集合


您可以键入hint multiple returns,并用管道符号分隔它们|

谢谢!有没有一种方法可以做到这一点?laravel返回集合。