开发者

proper phpdoc @return for factory method

I am curious how to docu开发者_如何学编程ment the following scenario. Imagine a group of classes:

abstract class Personality {}
class Me extends Personality {}
class Myself extends Personality {}
class Irene extends Personality {}

If I am writing a factory-esque method to instantiate and return a subclass of class Personality, how would I properly document the @return?

@return mixed  A "Personality" subclass object

or

@return Personality  A "Personality" subclass object


@return Personality A "Personality" subclass object

is the best. And IDE will provide you with autocomplete properties for the Personality class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜