Closed vladcosorg closed 8 years ago
Really the classes need to be broken apart. I've been trying to find some time to work on this.
I'm a derp. I thought this was for the php service provider. Ignore me :)
hmm I thought pimple 3 is fully supported, can you recheck it with this version http://silex.sorien.sk/download/master ...
Nope, with this version still no autocompletion inside closures, besides in cases where the plugin in repo worked fine (autocompletion outside closures) this one performs much slower and requires explicit Ctrl+Space to show the popup.
can you show me whole unit/fully working sample couse I can't reproduce it
btw there should be no performance difference between versions, it contains just few bug fixes, maybe you should try to invalidate caches (File -> Invalidate caches) and wait until all background tasks are finished (like index rebuild)
i don't understand your sample why are you mixin' $app and $this, according test case https://github.com/Sorien/silex-idea-plugin/blob/master/tests/sk/sorien/silexplugin/tests/pimple/PimplePhpTypeProviderTest.java#L146
plugin should provide correct type for first function parameter when you use this Pimple3 construct (http://pimple.sensiolabs.org/#modifying-services-after-definition)
// $this is pimple container or extends Pimple
$this['controllers'] = function ($app) { // plugin will provide type for $app var
return $app['controllers_factory'];
};
Sorry, it should be $app, not $this. I will provide more details and a better example soon. Thanks for looking into that!
Here's a better example
<?php
namespace myapp\plugin\service\module\event;
use myapp\plugin\service\Application;
use myapp\plugin\service\ServiceProviderInterface;
class Init implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['event.post_config'] = function ($app){
$event = new EventPostConfig($app['param.theme_prefix'], $app['acf_manager'], $app['wpml.manager']);
return $event;
};
$app['event.repo'] = function ($app) {
return new Repository(Entity::FQCN, 'post');
};
}
public function boot(Application $app)
{
}
}
Custom service provider interface
<?php
namespace myapp\plugin\service;
interface ServiceProviderInterface
{
public function register(Application $app);
public function boot(Application $app);
}
The Application
container extends Pimple\Container
Outside the function scope, the completion works fine
However inside that's what happens
and the services are marked as errors $app may not support offset operations
i can't reproduce it with pimple 1.x will try with 3.x tomorrow ... do you have any other PHP provider plugin installed? are you using PhpStorm or IntelliJ, which version?
I've got Symfony plugin if that's what you mean by "Php Provider" and Php Inspections (EA extended). I disabled all non-standart phpstorm plugins, the services marked as errors went away (it was from Php Inspections) but still, the services inside the function are not autocompleted...
Still the plugin is a great time-saver for me even with half of the features! )
I still can't reproduce it, pls install PsiViewer extension and check Variable signature
it should be something like #Š#C\Application
There you go
pls try this one http://sorien.sk/silex-plugin.zip
It works! Thanks a lot mate!
I've autoupdated from phpstorm plugin manager, i guess this link contains the same version.
I am glad to hear that, they're almost same, there is no functional change, just one recursion limiter is set to not so strict value ...
I'm using this plugin inside a project with standalone Pimple 3, i adapted the dumper in order to get valid pimple.json and so far the plugin works great, the only issue is that the service definition has changed in Pimple 3 from
and the
$app['controllers_factory'];
inside the closure does not get autocompletion and gets marked as error.Would be great if it supported this use-case!