Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Methods from classes static instance doesn't work (not linking correctly) #372

Open
ignacruiz opened this issue Nov 29, 2017 · 2 comments
Open

Comments

@ignacruiz
Copy link

Hope explain correctly, example at bottom.
New [new x();] instanced objects works ok, if you CTRL + mouse over the method, you have the click auto-open option and go to the class-method concrete line. The same but using static instace [x::method()] just open the class never goes to the method.

Example:
one.php:

<?php
class MyClass {
    public function test() {
        
    }
}

two.php

<?php
require_once("one.php");

$demo = new MyClass();
$demo->test();

MyClass::test();

If you CTRL+click on "->test();" from "$demo->test();" line, file one.php is opened and focused on "public function test()" line.

If you do the same on "::test();" it just open one.php but no focus on the method, just the class declaration.

The silly example is a short class, but long classes (for example adding some string property with long value could be proof for testing) doesn't locate you on the file and could be nice, cause some frameworks (and me) combine static instances with object instances. Ty!

@nevadascout
Copy link
Member

Hey, thanks for reporting this but Crane doesn't support go-to-definition on methods yet -- only classes. Are you using another PHP code completion plugin?

@nachazo
Copy link

nachazo commented Nov 30, 2017

I'm confused! I was totally sure that ctrl+click feature was from your extension. I have "PHP Extension Pack". I don't know if this add the ctrl+click go-to method feature, but it's working for "$a = new a(); $a->hello();", not for "a::hello()".
Sorry then, maybe not issue, a feature request :)

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

No branches or pull requests

3 participants