Vscode-intelephense: Support IoC containers and service locators

Created on 6 Dec 2017  路  11Comments  路  Source: bmewburn/vscode-intelephense

Can you have time to parse it or implement a similar implementation?
I found that the laravel framework is very similar to the need for smart tips, thank you!

.phpstorm.meta.zip

from:https://github.com/barryvdh/laravel-ide-helper

enhancement

Most helpful comment

I'm not familiar with phpstorm but as I understand it this meta file enables completion for cases like fetching instances from dependency injection containers and service locators? I would like to see this added in the future.

All 11 comments

I'm not familiar with phpstorm but as I understand it this meta file enables completion for cases like fetching instances from dependency injection containers and service locators? I would like to see this added in the future.

It would be great!!

It is the only thing that is missing so that definitely vs code can be used with the facades and autocomplete of Laravel!

https://github.com/SublimeCodeIntel/SublimeCodeIntel It works fine for [sublime] more instead of reading the file [.phpstorm.meta.php] I believe it looks, reads the file [_ide_helper.php]

I use Laravel full time and have recently switched to VS Code. This is probably the only functionality that makes me miss PHP Storm.

Just want to add that I would also find this extremely helpful, I am the only developer not using PHP Storm and they never stop letting me forget it, this missing function is the main reason :)

+1

I have no idea what .phpstorm.meta is. I used PHPStorm for years as well. Regardless, I don't think parsing something like this is a good idea at all. However, the ability to handle DI containers is certainly of high value. Personally, we use Symfony's service container. Obviously some others are using Laravel.

I think the general idea here is to use "stubs"? I noticed a link to this ticket from another discussion. It'd be nice to close this ticket and open another ones that's more inclusive and directly focuses on stubs. Additionally, it'd be nice to get some examples and documentation on how stubs are built.

@oojacoboo I'm open to other ideas on how to define the typings. Though I think phpdoc stubs (the std annotations anyway) are not enough because the container class may be generic and the returned value differs in some case by the key or argument value.

$foo = $container->get('foo') 
$foo = $container['foo'];
$foo = $container->foo;

I guess some custom annotation could be used?
@accessor <return_type> <fqsen>
eg
@accessor Foo Container::foo

@bmewburn I agree. I haven't looked into how "stubs" are implemented. and, like you say, it depends on the parameter passed to the getter, most of the time with DI containers.

Honestly, I don't see this working any other way than parsing the DI container configs directly. There is another plugin working on something for Symfony:

https://github.com/TheNouillet/symfony-vscode

Of course, I have no idea how well these will play together and it's not currently DI container agnostic, instead only supporting Symfony framework codebases.

Strongly recommending this feature becomes higher priority in the todo list.
Modern PHP developing is almost based on framework, And many of them are depending the IoC mechanism. eg: Laravel, Symfony, Yii...

Phpstorm metadata override support implemented in 1.1. Tracking expectedArguments support in #471

Was this page helpful?
0 / 5 - 0 ratings

Related issues

9brada6 picture 9brada6  路  3Comments

steven7mwesigwa picture steven7mwesigwa  路  4Comments

ghost picture ghost  路  3Comments

ottopic picture ottopic  路  3Comments

ghnp5 picture ghnp5  路  3Comments