Use 'static' return type in docblock
opened this issue · comments
Deleted user commented
For example:
/**
* @param string $name
* @return static
*/
public function setName($name)
{
$this->name = (string) $name;
return $this;
}
Instead @return AbstractMemberGenerator
Michał Bundyra commented
I think in that case we should use $this
, there is slightly difference between static
and $this
and I think it is good explained in PSR-5 draft (the bottom of the page):
https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md
$this
, the element to which this type applies is the same exact instance as the current class in the given context. As such this type is a stricter version of static as, in addition, the returned instance must not only be of the same class but also the same instance.
Deleted user commented
I agree
Matthew Weier O'Phinney commented
This repository has been closed and moved to laminas/laminas-code; a new issue has been opened at laminas/laminas-code#7.