Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse USE statements in function definitions #127

Closed
vakata opened this issue Oct 29, 2016 · 4 comments
Closed

Parse USE statements in function definitions #127

vakata opened this issue Oct 29, 2016 · 4 comments

Comments

@vakata
Copy link
Contributor

vakata commented Oct 29, 2016

First of all - thank you for this great piece of code.

In the following example (just meaningless code) using VS code I get a nice peek of the getInstance definition, but not of the debug definition:

$log = new Logger();
(new Router())->middleware(function ($req, $next) use ($log) {
    $di = new DI();
    $di->getInstance(SomeClass::class);
    $log->debug("Got class");
    return $next();
})

Is it possible to hint for the variables imported using use?

@vakata vakata changed the title Parse USE statements in function calls Parse USE statements in function definitions Oct 29, 2016
@felixfbecker
Copy link
Owner

See #54

@vakata
Copy link
Contributor Author

vakata commented Oct 29, 2016

Thank you for the fast reply. I created the issue exactly because I saw that use statements should work (as described in the same issue). I must have misunderstood - I guess you mean the imported vars are resolved to the actual use statement, and not recursively.
I will follow the other issue - thank you.

@felixfbecker
Copy link
Owner

Yeah, the definition should be resolved to the use statement - this allows you to find all references for the use and if there is none, you know you can remove it.

@felixfbecker
Copy link
Owner

I agree though that for method definitions, this is counter-intuitive. #54 will solve this by adding a concept of "types", so we have the type of the use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants