0

I am looking for a solution to declare properly a lazy service injector for the PhpStorm IDE. Here is an example:

$app = new Silex\Application();

/**
* ???
*/
$app['file'] = function() {
  return new M_file();
};
LazyOne
  • 158,824
  • 45
  • 388
  • 391
Samuel C.
  • 55
  • 6
  • As far as I know, you can't declare the type of each array element independently. One solution is assign the value to a new variable where you want to use it (in a controller class for example) and declare the type of that variable. – Nima Mar 21 '19 at 15:25
  • Check Silex/Pimple related plugins, they may help. In general, [Advanced Metadata](https://www.jetbrains.com/help/phpstorm/ide-advanced-metadata.html) is usually used for such stuff, but I don't think it work well with arrays (but does work with `$app->get('someService')` kind of stuff; Look at what IDE helper for Laravel generates, see https://github.com/barryvdh/laravel-ide-helper). – LazyOne Mar 21 '19 at 15:35
  • @LazyOne Thanks for this plugin I didn't know it. Very useful indeed! Unfortunately that doesn't solve this issue... – Samuel C. Mar 26 '19 at 09:20

0 Answers0