Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Add gotoDefinition support for local variable #1

Merged
merged 2 commits into from May 9, 2020

Conversation

FatBoyXPC
Copy link
Contributor


$name = $offset->symbolContext()->symbol()->name();
$frame = $offset->frame();
$variable = $frame->locals()->byName($name)->first();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a guard?

$variables = $frame->locals()->byName($name);
if ($variables->count() === 0) {
    throw new CouldNotLocateDefinition(sprintf('Could not find variable "%s" in scope', $name));
}

?

@dantleech dantleech merged commit 3de5c74 into phpactor:master May 9, 2020
@dantleech
Copy link
Contributor

Thanks :)

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

Successfully merging this pull request may close these issues.

Go to definition on local variable
2 participants