phpDocumentor/ReflectionDocBlock

Bug in empty shapes

SerafimArts opened this issue · 2 comments

Given the following code

/**
 * @psalm-var list{} Empty sealed list
 * @psalm-var array{} Empty sealed array
 * @psalm-var object{} Empty sealed object
 */
foreach ($factory->create($code)->getTags() as $tag) {
    var_dump($tag->getDescription()->getBodyTemplate());
}

Expected output

string(N) "list{} Empty sealed list"
string(N) "array{} Empty sealed array"
string(N) "object{} Empty sealed object"

Actual

string(N) "list} Empty sealed list"
string(N) "array} Empty sealed array"
string(N) "object} Empty sealed object"

Problem located here: https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/src/DocBlock/DescriptionFactory.php#L77-L83

The meaning of such substitutions is not entirely clear. For what?

You are hitting an issue that conflicts with inline tags. Right now this library cannot handle both situations properly.
I was working on a new version of our type resolver. But due time limits and other work that was postponed.
At the moment the 1.x branch of type resolver should do this in a better way. But as I said that's work in progress.

As I'm the only person working on this, I cannot do any promises about when I will finish this work.

I just checked this issue in more depth. The next release will support array-shapes, we are missing some types which are collected in this issue: phpDocumentor/TypeResolver#205

Once those are addressed this will be solved automatically.