Use 'static' return type in docblock
For example:
/**
* @param string $name
* @return static
*/
public function setName($name)
{
$this->name = (string) $name;
return $this;
}
Instead @return AbstractMemberGenerator
Originally posted by @ViktorPegy at https://github.com/zendframework/zend-code/issues/148
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.
Originally posted by @michalbundyra at https://github.com/zendframework/zend-code/issues/148#issuecomment-350986774
I agree
Originally posted by @ViktorPegy at https://github.com/zendframework/zend-code/issues/148#issuecomment-350989644
The code is now uses @return AbstractMemberGenerator
https://github.com/laminas/laminas-code/blob/40919916c4ca6ad815874539cf528814429f0269/src/Generator/AbstractMemberGenerator.php#L200