phpDocumentor / ReflectionDocBlock

MIT License
9.35k stars 119 forks source link

Support reference in method tag #332

Closed villfa closed 2 years ago

villfa commented 2 years ago

This PR makes the following docblock parseable:

/**
 * @method &foo()
 */
class Test
{
    public $values = [];
    public function &__call($name, $args)
    {
        $this->values[$name] ??= null;
        return $this->values[$name];
    }
}

See this sample in action: https://3v4l.org/CXuLL

The Method class has now a method returnsReference(): bool. This name comes from ReflectionFunctionAbstract::returnsReference.

villfa commented 2 years ago

Thanks @jaapio for accepting this change. Would it ok to make a new release? I plan to use it for another PR to phpDocumentor.

jaapio commented 2 years ago

I'm ok to get an PR on phpDocumentor using a dev version of this library, if that helps you to prepare a new PR :-)

I hope I will have some more time next week to finalize some open PR's in this repo before creating a new release.