Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPdoc: Documenting chainable methods?

How should I properly use PHPdoc to document chainable methods in a class, as seen in the below example - what is the correct usage?

class myClass {


    /**
    * @return myClass
    */
    function one()
    {
        return $this;
    }

    /**
    * @return self
    */
    function two()
    {
        return $this;
    }

    /**
    * @return $this
    */
    function three()
    {
        return $this;
    }

}
like image 475
Industrial Avatar asked Aug 25 '11 09:08

Industrial


1 Answers

/**
* @return myClass
*/

I'm not a phpDoc expert but's that's how they do it in Zend framework. So I think it's reliable

like image 127
yokoloko Avatar answered Nov 14 '22 20:11

yokoloko