phpDoc notation to specify return type identical to parameter type

。_饼干妹妹 提交于 2019-12-04 08:27:02

Probably the best an IDE could do here would be if your @return on addFilter() actually listed all the possible BaseFilter children that could be returned:

@return BaseFilter|TextFilter|AnotherFilter

This might trigger your IDE into providing all the possible methods for all those possible return classes. It depends on whether or not the IDE in use knows how to recognize such a list of possible return types. Obviously this would get tedious on your part though, putting such a list in many return tags.

I do not know of any IDE that would look at your return type of BaseFilter alone, generate a list of all possible parent+child methods, and thus make that whole list available for autocompletion automagically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!