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.
@return Current_Class_Namewill definitely work and is what I prefer.@return selfmay work ok with some programs too.@return thisis bad because this is not a typename.