Skip to content

Go to symbol referenced in docblock #494

Closed

Description

@weirdan
/**
 * @param A<>|B $p
 */
function f($p): void {}

Assume the cursor is in the '<>' position. It would be great if PHPActor would be able to navigate (and, ideally, support all other features like context menu from that point) to As definition, like it can when A is referenced in executable code.

Currently it complains about 'symbol type '

Activity

  1. dantleech commented on Jun 8, 2018

    @dantleech
    Collaborator

    Yep, will probably need to enable this in WorseReflection.

  2. dantleech commented on Jun 9, 2018

    @dantleech
    Collaborator

    Have been looking at this, it's tricky. In order to do it properly we need to be able to reflect the docblock itself (f.e. using the phpstan docblock parser). This means injecting more responsiblity into WorseReflection, and the current architecture isn't very open to this.

    We could do this in a naieve way the Phpactor GotoDefinition code: if the Symbol type is <unknown> then assume that the current word is a class name and resolve that to an FQN (there is some functionality exposed for this purpose from WR). Additionally it might be reasonable for WR to flag if a given offset is whitespace / comments.

  3. weirdan commented on Jun 9, 2018

    @weirdan
    ContributorAuthor

    That would probably be enough. I don't see myself doing renames and other stuff from docblock. I've grown accustomed to the menu though, so would appreciate if it would work as well, even if it has only go to definition entry.

  4. dantleech commented on Dec 21, 2018

    @dantleech
    Collaborator

    This was done in #679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions