vscode-intelephense
vscode-intelephense copied to clipboard
Support auto import for traits in all scopes
Feature description or problem with existing feature
Currently, PHP Intelephense offers auto import for traits only after the use keyword (inside a class-like scope).
However, it is valid to call a static method from a trait anywhere. Or maybe you just need to reference the trait's FQCN somewhere (like in MyTrait::class).
It's worth noting that, once the trait is already imported, auto-complete works perfectly when calling trait static methods.
Describe the solution you'd like
<?php
namespace MyNamespace;
trait MyCoolTrait {
public static function someMethod() {}
}
<?php
namespace MyOtherNamespace;
class MyClass {
public static function doSomething(): void {
MyCoolTr // auto-complete/auto-import would be wonderful here!
}
}