PHPStorm, Silex DI Index Code Completion

I am trying PHPStorm and have problems completing it. I am writing a project with the Silex framework and am confronted with the lack of PHPStorm code to complete the code for the Silex injection container. For example, this is not codecomplete $app['twig']-> or $app['db']-> or any other service. The only way I found is to do something like this

 $db = $app['db']; /** @var $db \Doctrine\DBAL\Connection */ $db->.... 

And then PHPStorm will complete the code. Services are registered using the ServiceProvider interface. Is there any way to make PHPStorm do code completion in such cases without additional vars and comments?

+6
source share
2 answers

As far as I know, this is currently not possible, however, work is currently underway to add support for common factory templates, see this problem in their error log:

http://youtrack.jetbrains.com/issue/WI-6027

PhpStorm developers welcome new feature requests to their tracker and are very responsive. So you can submit a function request

Also, this might be related to your question: http://youtrack.jetbrains.com/issue/WI-5304

+7
source

Here's the plugin for PHPStorm / Intellij IDEA: https://plugins.jetbrains.com/plugin/7809?pr=

I have not tried it yet, but it looks promising ...

Edit: just took a quick shot, and it looks really cool and easy to configure:

  • Install the plugin through the IDE plugin manager

  • Add the following dependency:

 "require": { "sorien/silex-pimple-dumper": "~1.0" } 
  • Register Supplier:

    $ app-> register (new Sorien \ Provider \ PimpleDumpProvider ());

And you're done.

+1
source

All Articles