vscode-intelephense
vscode-intelephense copied to clipboard
Intelephense should not display static functions on a class instance
I'm not sure if this is because of the nature of PHP so let me know. I don't think Intelephense should autocomplete static functions on a class instance. At least it should display a difference between the two. See below. I can't tell which functions are static and which aren't just by looking at the autocomplete box.
To Reproduce
class A {
public static function aStaticFoo() {}
public function bFoo() {}
}
$a = new A();
$a-> // here Intelephense shows aStaticFoo() the same way it shows bFoo()
Expected behavior Shows only instance methods, or at leave static methods to the bottom with a visual difference.
Screenshots
Platform and version Intelephense 1.3.6
This used to be the case but it was changed due to confusion over why some methods weren't showing. For example phpunit asserts are all static methods but all the online documentation shows them called with ->
.
Styling them different would be a vscode thing and the language server protocol would need to specify modifiers that could be sent to identify as static before something like this could be implemented.
Good idea about sorting last though, I'll keep this open to track that addition.
Ah phpunit... I see. The only reason I'm bothered by this is because when using Laravel Eloquent Model, I get a lot of static methods from the base class. I guess showing static functions fixes phpunit but makes Laravel Model ugly. Great extension either way. Thanks!
Duplicated #601 (don't know if this will be improved in the future, don't think so)
Could there be an option in the settings (not) to display static methods in a non-static environment (arrow)? It would be advantageous to easily distinguish between static and non-static methods. Or perhaps sorted last/different icon?
tracking in #2538