phpDocumentor / phpDocumentor/Reflection

Can't properly determine Object_'s name without context

Open
#236 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
125
Forks
60
Avg merge
2m
Merged PRs (30d)
9

Description

Consider such PhpDoc comment as an example:

/**
 * @param DocBlock\Tags\Var_ $varTag
 *                                  
 * @return \My\Super\Class
 */

When parsing this, I will have two Object_'s, one for DocBlock\Tags\Var_, second for \My\Super\Class. The problem is that if I have no context, (string) $object->getFqsen() will return them both with leading slash:

\DocBlock\Tags\Var_
\My\Super\Class

While $type->getFqsen()->getName() will return just the last part of the name for both of them:

Var_
Class

Meaning, that I can't get the original form of the reference without specifying the context, which I don't actually want to, cause it is redundant in my case.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two PhpDoc examples and inspect how Object_, getFqsen(), and getName() represent qualified names when no context is supplied. Done means the original relative versus absolute reference form can be distinguished or recovered without redundant context, with both examples behaving correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.