microsoft / microsoft/tolerant-php-parser

Unable to get resolved name for use clause name

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

Nobody has claimed this yet.

Dominant language
PHP
Stars
894
Forks
85
Avg merge
2d 13h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

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

Read src/Node/QualifiedName.php around line 87, then trace how getResolvedName handles names used in class trait clauses. The work is complete when the example's use-clause name returns Something\HelloTrait instead of null without breaking existing resolution behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.