我有一个返回集合的类:
public function getCustomers() : Collection;当我循环结果时,PhpStorm IDE将不知道集合中有什么内容。
在.NET/JAVA中,您将编写:
public <List<Customer>> getCustomers();然后IDE将知道集合中的内容,并知道如何完成/提示它。
有什么窍门可以把它介绍给PhpStorm吗?
发布于 2017-03-19 16:14:21
使用文档块很容易:
/**
* @return Customer[]|Collection
*/
public function getCustomers();本质上,您在这里所做的是告诉phpStorm,该函数还返回一个Customer对象数组和Collection。
您可以键入提示、多个返回、用管道符号来分隔它们。
https://stackoverflow.com/questions/42888812
复制相似问题