tolerant-php-parser icon indicating copy to clipboard operation
tolerant-php-parser copied to clipboard

Unable to get resolved name for use clause name

Open dantleech opened this issue 8 years ago • 2 comments
trafficstars

Getting the resolved name of a use clause using QualifiedName#getResolvedName is explicitly disallowed and I am not sure why, it seems legitimate to me?

namespace SomeNamespace;

use Something\HelloTrait;

class Foobar
{
    use HelloTrait;
}
$name->getResolvedName()

Expected: Something\HelloTrait Actual: null.

dantleech avatar Aug 06 '17 19:08 dantleech

I don't have a good answer... it seems like they should be resolved in a similar way to usages of the names. I'm not sure why that limitation is in place, but that API is used in a lot of places, so I'll have to think about it some more.

roblourens avatar Aug 08 '17 05:08 roblourens

Good catch. Honestly, based on the blame / commit history - it looks like a hack that inadvertently got committed from when I was working on completions support. So removing it might break something with completions, but that something should probably be fixed in other ways :wink:

mousetraps avatar Aug 09 '17 06:08 mousetraps