Should I use @return self, this or the current class? [closed]
I have a method that return the current object, how do I document this? /** * set something * * @return this */ public function setSomething(){ // ... return $this; } Or should I do @return self or @return Current_Class_Name ? Reason why this question is not "primarily opinion-based" (and should be reopened): conformance to standards and IDE type hinting support. RiaD @return Current_Class_Name will definitely work and is what I prefer. @return self may work ok with some programs too. @return this is bad because this is not a typename. g . There is a PHP Standards Recommendation (PSR)