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.
精彩评论